Original title:
Pattern matching in compilers
Translated title:
Pattern matching in compilers
Authors:
Bílka, Ondřej ; Hubička, Jan (advisor) ; Mareš, Martin (referee) Document type: Master’s theses
Year:
2012
Language:
eng Abstract:
[eng][cze] Title: Pattern matching in compilers Author: Ondřej Bílka Department: Department of Applied Mathematics Supervisor: Jan Hubička, Department of Applied Mathematics Abstract: 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 implement- ing 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 reg- ularized regular expressions. Amethyst uses techniques known from compiler optimizations to produce effective parsers. Keywords: Packrat parsing, dynamic parsing, structured grammars, functional programming 1Název práce: Pattern matching in compilers Autor: Ondřej Bílka Katedra: Katedra Aplikované Matematiky Vedoucí diplomové práce: Jan Hubička, Katedra Aplikované Matematiky Abstrakt: V této práci vyvineme nástroje na efektivní a flexibilní pattern matching. Představíme specializovaný programovací jazyk amethyst. Jedna z funkcí amethystu je generatování parserů. Také může sloužit jako alterna- tiva k regulárním výrazum. Naš systém umí generovat dynamické parsery. Jejich hlavní uplatnění je tvorba nástroju do IDE jako např. interaktivní zvýrazňovač syntaxe nebo detektor chyb. Amethyst umí zpracovávat i obecné datové struktury. Plánované využití je implementace kompilátorových optimal- izací jako napřiklad propagace konstant či rozvrhování instrukcí a jiné optimal- izace založené na dataflow analyze. Generované parsery jsou víceméně top-down parsery. Představíme nový algo- ritmus pro parsovaní strukturovaných gramatik v linearním čase. Amethyst používá techniky z kompilatorů pro optimalizovaní generovaných parserů. Klíčová slova: packrat parsování, dynamické parsování, strukturované gramatiky, funkcionální programování 1
Keywords:
code generation; compiler; lexical analysis; optimization,packrat parsing; parser; pattern matching; generování kódu; lexikální analýza; optimalizace,packrat parsing; překladač,vyhledávání vzorů,parser
Institution: Charles University Faculties (theses)
(web)
Document availability information: Available in the Charles University Digital Repository. Original record: http://hdl.handle.net/20.500.11956/40833