Get flash to fully experience Pearltrees
In this tutorial, I will teach you all you need to know to be able to craft powerful time-saving regular expressions. I will start with the most basic concepts, so that you can follow this tutorial even if you know nothing at all about regular expressions yet. But I will not stop there.
Next: Ambiguous and confusing grammars Up: CS2121: The Implementation and Previous: YACC: Further usage Subsections How lexers and parsers work Lexers - Finite State Automata (FSA) Lexers are also known as scanners . LEX converts each set of regular expressions into a Deterministic FSA (DFSA) e.g. for a(b|c)d*e+
Formal language - Grammar
You need a parser and want to use ANTLR, but you never learned how to write parser grammars? Then the following tutorial should teach you the very basics of understanding on following matters: EBNFs Left recursion Grammar ambiguities Difference between lexer and parser rules How to define tokens How to build a grammar from a language specification Nonetheless the study of a few books will be helpful: The free Basics of Compiler Design and Compiler Construction PDFs and the famous dragon book in the newest edition for understanding the theory of compilers and The Definitive ANTLR Reference for in-depth understanding of intricate details of the ANTLR software and how to write complex grammars. The use of ANTLRworks is heavily recommended.
By Daniele Paolo Scarpazza , December 12, 2006 Source Code Accompanies This Article. Download It Now. parse_c.txt Daniele discusses the design of an ANSI C parser front-end, identifying the pitfalls that make design tricky. Front-ends are present in all applications that process source code—compilers, interpreters, linters, and the like.
November 15, 2009 Among programmers of any experience, it is generally regarded as A Bad Idea tm to attempt to parse HTML with regular expressions. How bad of an idea? It apparently drove one Stack Overflow user to the brink of madness :