1,760 research outputs found

    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

    Systems of Sequential Grammars Applied to Parsing

    Get PDF
    Tato práce zkoumá Gramatické systémy jako potenciálně silnější nástroj pro syntaktickou analýzu, nežli obyčejné gramatiky. Hlavním záměrem je aplikace teoretických modelů do praxe, vytvoření syntaktického analyzátoru. Jsou zavedeny nové metody zaměřené na determinizmus, a tím vyhnutí se zpětnému navracení při analýze. Základem analyzátoru je CD gramatický systém. Implementace využívá metodu prediktivní syntaktické analýzy, překlad řízený tabulkou a také rekurzi. Analyzátor je univerzální, použitelný pro jakékoliv LL-Gramatiky a jakékoliv gramatické systémy na nich založené.This thesis examines Grammar systems as the potentially more powerful tool for parsing as the simple grammars. The intention is to adapt theoretical models of grammar systems for parsing. New methods are introduced, with focus on determinism in order to prevent backtracking during parsing. The basis for the parser is a cooperating distributed grammar system. The implementation uses predictive, top-down parsing method, LL(1)Tables, and recursion as well. The parser is universal, usable for any LL-Grammar and for any grammar system based on them.

    Stream Processing using Grammars and Regular Expressions

    Full text link
    In this dissertation we study regular expression based parsing and the use of grammatical specifications for the synthesis of fast, streaming string-processing programs. In the first part we develop two linear-time algorithms for regular expression based parsing with Perl-style greedy disambiguation. The first algorithm operates in two passes in a semi-streaming fashion, using a constant amount of working memory and an auxiliary tape storage which is written in the first pass and consumed by the second. The second algorithm is a single-pass and optimally streaming algorithm which outputs as much of the parse tree as is semantically possible based on the input prefix read so far, and resorts to buffering as many symbols as is required to resolve the next choice. Optimality is obtained by performing a PSPACE-complete pre-analysis on the regular expression. In the second part we present Kleenex, a language for expressing high-performance streaming string processing programs as regular grammars with embedded semantic actions, and its compilation to streaming string transducers with worst-case linear-time performance. Its underlying theory is based on transducer decomposition into oracle and action machines, and a finite-state specialization of the streaming parsing algorithm presented in the first part. In the second part we also develop a new linear-time streaming parsing algorithm for parsing expression grammars (PEG) which generalizes the regular grammars of Kleenex. The algorithm is based on a bottom-up tabulation algorithm reformulated using least fixed points and evaluated using an instance of the chaotic iteration scheme by Cousot and Cousot

    Locally Chain-Parsable Languages

    Get PDF
    If a context-free language enjoys the local parsability property then, no matter how the source string is segmented, each segment can be parsed in- dependently, and an efficient parallel parsing algorithm becomes possible. The new class of locally chain-parsable languages (LCPL), included in deterministic context-free languages, is here defined by means of the chain-driven automa- ton and characterized by decidable properties of grammar derivations. Such au- tomaton decides to reduce or not a factor in a way purely driven by the terminal characters, thus extending the well-known concept of Input-Driven (ID) (visibly) pushdown machines. LCPL extend and improve the practically relevant operator- precedence languages (Floyd), which are known to strictly include the ID lan- guages, and for which a parallel-parser generator exists. Consistently with the classical results for ID, chain-compatible LCPL are closed under reversal and Boolean operations, and language inclusion is decidable

    A proposed translator writing system language - Computer project, volume 3, no. 1

    Get PDF
    Programming language for advanced translator writing syste

    Two characterisation results of multiple context-free grammars and their application to parsing

    Get PDF
    In the first part of this thesis, a Chomsky-Schützenberger characterisation and an automaton characterisation of multiple context-free grammars are proved. Furthermore, a framework for approximation of automata with storage is described. The second part develops each of the three theoretical results into a parsing algorithm
    corecore