Index: A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
Home > Parser
A parser is a computer program or a component of a program that analyses the grammatical structure of an input, with respect to a given formal grammar, a process known as parsing. Parsers can be made both for natural languages and for programming languages. Programming language parsers tend to be based on context free grammars as fast and efficient parsers can be written for them. For example LALR parsers are capable of efficiently analysing a wide class of context free grammars. Such parsers are usually not written by hand but generated by parser generators.The task of the parser can be summarized as to determine if and how the input can be derived from the start symbol with the rules of the formal grammar. A parser can do this in essentially two ways: it can start with the input and attempt to rewrite it to the start symbol, a so-called bottom-up parser, or it can start with the start symbol and try to rewrite it to the input, a so-called top-down parser. For example LL parsers are top-down parsers and LR parsers are bottom-up parsers.
Another important distinction is whether the parser generates a leftmost derivation or a rightmost derivation (see context-free grammar). LL parsers will generate a leftmost derivationThere are several meanings of derivation A derivation in abstract algebra is a linear map that satisfies Leibniz' law. A derivation in computer science is a parse tree representing one possible way to parse a string using a context-free grammar. A derivat and LR parsers will generate a rightmost derivation (although usually in reverse).
1 Overview of Parsers
1.1 Top-down parsers
Some of the parsers that use top-down parsing include:
- Recursive descent parserA recursive descent parser is a top-down parser built from a set of mutually-recursive procedures or a non-recursive equivalent where each such procedure usually implements one of the production rules of the grammar. Thus the structure of the resulting pr
- LL parser
- Packrat parserA packrat parser is a form of parser similar to a recursive descent parser in construction, except that during the parsing process it memoizes the intermediate results of all invocations of the mutually recursive parsing functions. Because of this memoiza
- Unger parser
1.2 Bottom-up parsers
Some of the parsers that use bottom-up parsing include:
2 See also
Read more »