18 research outputs found

    Static Type Checking for the Q Functional Language in Prolog

    Get PDF
    We describe an application of Prolog: a type checking tool for the Q functional language. Q is a terse vector processing language, a descendant of APL, which is getting more and more popular, especially in financial applications. Q is a dynamically typed language, much like Prolog. Extending Q with static typing improves both the readability of programs and programmer productivity, as type errors are discovered by the tool at compile time, rather than through debugging the program execution. We designed a type description syntax for Q and implemented a parser for both the Q language and its type extension. We then implemented a type checking algorithm using constraints. As most built-in function names of Q are overloaded, i.e. their meaning depends on the argument types, a quite complex system of constraints had to be implemented. Prolog proved to be an ideal implementation language for the task at hand. We used Definite Clause Grammars for parsing and Constraint Handling Rules for the type checking algorithm. In the paper we describe the main problems solved and the experiences gained in the development of the type checking tool

    Modeling Structure-Function Relationships in Synthetic DNA Sequences using Attribute Grammars

    Get PDF
    Recognizing that certain biological functions can be associated with specific DNA sequences has led various fields of biology to adopt the notion of the genetic part. This concept provides a finer level of granularity than the traditional notion of the gene. However, a method of formally relating how a set of parts relates to a function has not yet emerged. Synthetic biology both demands such a formalism and provides an ideal setting for testing hypotheses about relationships between DNA sequences and phenotypes beyond the gene-centric methods used in genetics. Attribute grammars are used in computer science to translate the text of a program source code into the computational operations it represents. By associating attributes with parts, modifying the value of these attributes using rules that describe the structure of DNA sequences, and using a multi-pass compilation process, it is possible to translate DNA sequences into molecular interaction network models. These capabilities are illustrated by simple example grammars expressing how gene expression rates are dependent upon single or multiple parts. The translation process is validated by systematically generating, translating, and simulating the phenotype of all the sequences in the design space generated by a small library of genetic parts. Attribute grammars represent a flexible framework connecting parts with models of biological function. They will be instrumental for building mathematical models of libraries of genetic constructs synthesized to characterize the function of genetic parts. This formalism is also expected to provide a solid foundation for the development of computer assisted design applications for synthetic biology

    Pattern matching in compilers

    Get PDF
    In this thesis we develop tools for effective and flexible pattern matching. We introduce a new pattern matching system called amethyst. Amethyst is not only a generator of parsers of programming languages, but can also serve as an alternative to tools for matching regular expressions. Our framework also produces dynamic parsers. Its intended use is in the context of IDE (accurate syntax highlighting and error detection on the fly). Amethyst offers pattern matching of general data structures. This makes it a useful tool for implementing compiler optimizations such as constant folding, instruction scheduling, and dataflow analysis in general. The parsers produced are essentially top-down parsers. Linear time complexity is obtained by introducing the novel notion of structured grammars and regularized regular expressions. Amethyst uses techniques known from compiler optimizations to produce effective parsers.Comment: master thesi

    Tunnel Parsing with counted repetitions

    Get PDF
    The article describes a new and efficient algorithm for parsing, called Tunnel Parsing, that parses from left to right on the basis of a context-free grammar without left recursion and rules that recognize empty words. The algorithm is applicable mostly for domain-specific languages. In the article, particular attention is paid to the parsing of grammar element repetitions. As a result of the parsing, a statically typed concrete syntax tree is built from top to bottom, that accurately reflects the grammar. The parsing is not done through a recursion, but through an iteration. The Tunnel Parsing algorithm uses the grammars directly without a prior refactoring and is with a linear time complexity for deterministic context-free grammars

    Program extraction applied to monadic parsing

    Get PDF

    A Program for Analysis of Context-free Grammars

    Get PDF
    V rámci této diplomové práce vznikl program, který umí analyzovat určité vlastnosti bezkontexto- vých gramatik a také s nimi provádět různé operace. Příslušná problematika a související informace jsou popsány v teoretické části práce. Další samostatné kapitoly se věnují konkrétnímu návrhu to- hoto programu a jeho implementaci. V závěru je funkčnost programu demonstrována na příslušných bezkontextových gramatikách. Možných funkcí, vlastností a operací nad gramatikami existuje ob- rovské množství. Tento program umožňuje výpočet množin F IRST a F OLLOW , provádění redukce gramatiky, odstranění epsilon-pravidel, odstranění jednoduchých pravidel, převod do Chomského a Greibachové normálních forem a konstrukci ekvivalentního nedeterministického zásobníkového au- tomatu. Dále umí program detekovat LR(0) a LL(1) typy gramatik, počítat LR položky, detekovat související konflikty a validovat vstupní řetězce. Od počátku byl program navrhován tak, aby jej bylo možné v budoucnu rozšířit o novou funkcionalitu.Within this diploma thesis, there was created a program that can analyze certain properties of context-free grammars and also perform various operations on them. The relevant theory and in- formation on this topic are described in the theoretical part of the thesis. Next chapters are devoted to the particular design of this program and its implementation. Finally, the functionality of the program is demonstrated on several examples of context-free grammars. There exist a huge number of possible functions, properties and operations over grammars. This program can compute F IRST and F OLLOW sets, perform grammar reduction, removal of epsilon rules, removal of simple rules, conversion to Chomsky and Greibach normal forms and construct an equivalent non-deterministic pushdown automaton. The program can also detect LR(0) and LL(1) types of grammars, compute LR items, detect related conflicts and validate input strings. From the beginning, the program was designed so that it could be extended with new functionality in the future.460 - Katedra informatikydobř
    corecore