Global Information Lookup Global Information

Recursive descent parser information


In computer science, a recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where each such procedure implements one of the nonterminals of the grammar. Thus the structure of the resulting program closely mirrors that of the grammar it recognizes.[1]

A predictive parser is a recursive descent parser that does not require backtracking.[2] Predictive parsing is possible only for the class of LL(k) grammars, which are the context-free grammars for which there exists some positive integer k that allows a recursive descent parser to decide which production to use by examining only the next k tokens of input. The LL(k) grammars therefore exclude all ambiguous grammars, as well as all grammars that contain left recursion. Any context-free grammar can be transformed into an equivalent grammar that has no left recursion, but removal of left recursion does not always yield an LL(k) grammar. A predictive parser runs in linear time.

Recursive descent with backtracking is a technique that determines which production to use by trying each production in turn. Recursive descent with backtracking is not limited to LL(k) grammars, but is not guaranteed to terminate unless the grammar is LL(k). Even when they terminate, parsers that use recursive descent with backtracking may require exponential time.

Although predictive parsers are widely used, and are frequently chosen if writing a parser by hand, programmers often prefer to use a table-based parser produced by a parser generator,[citation needed] either for an LL(k) language or using an alternative parser, such as LALR or LR. This is particularly the case if a grammar is not in LL(k) form, as transforming the grammar to LL to make it suitable for predictive parsing is involved. Predictive parsers can also be automatically generated, using tools like ANTLR.

Predictive parsers can be depicted using transition diagrams for each non-terminal symbol where the edges between the initial and the final states are labelled by the symbols (terminals and non-terminals) of the right side of the production rule.[3]

  1. ^ Burge, W.H. (1975). Recursive Programming Techniques. ISBN 0-201-14450-6.
  2. ^ Watson, Des (22 March 2017). A Practical Approach to Compiler Construction. Springer. ISBN 978-3-319-52789-5.
  3. ^ Aho, Alfred V.; Sethi, Ravi; Ullman, Jeffrey (1986). Compilers: Principles, Techniques and Tools (first ed.). Addison Wesley. p. 183.

and 23 Related for: Recursive descent parser information

Request time (Page generated in 0.8053 seconds.)

Recursive descent parser

Last Update:

computer science, a recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where...

Word Count : 1119

Parsing expression grammar

Last Update:

in practice, e.g. by a recursive descent parser. Unlike CFGs, PEGs cannot be ambiguous; a string has exactly one valid parse tree or none. It is conjectured...

Word Count : 6426

Parser combinator

Last Update:

parser combinator is a higher-order function that accepts several parsers as input and returns a new parser as its output. In this context, a parser is...

Word Count : 1730

Tail recursive parser

Last Update:

<identifier> A simple tail recursive parser can be written much like a recursive descent parser. The typical algorithm for parsing a grammar like this using...

Word Count : 369

Comparison of parser generators

Last Update:

John; Spiewak, Daniel (2010-09-17). "Tool Paper: ScalaBison Recursive Ascent-Descent Parser Generator". Electronic Notes in Theoretical Computer Science...

Word Count : 1106

Packrat parser

Last Update:

The Packrat parser is a type of parser that shares similarities with the recursive descent parser in its construction. However, it differs because it...

Word Count : 1860

Memoization

Last Update:

backtracking recursive descent parser to solve the problem of exponential time complexity. The basic idea in Norvig's approach is that when a parser is applied...

Word Count : 3744

Parsing

Last Update:

supporting some context-free grammars and parsing expression grammars Recursive descent parser: a top-down parser suitable for LL(k) grammars Shunting-yard...

Word Count : 4857

LL parser

Last Update:

computer science, an LL parser (Left-to-right, leftmost derivation) is a top-down parser for a restricted context-free language. It parses the input from Left...

Word Count : 4363

LL grammar

Last Update:

is about the formal properties of LL grammars; for parsing, see LL parser or recursive descent parser. Given a natural number k ≥ 0 {\displaystyle k\geq...

Word Count : 1997

Recursive ascent parser

Last Update:

recursive ascent parsing is a technique for implementing an LR parser which uses mutually-recursive functions rather than tables. Thus, the parser is...

Word Count : 2004

Spirit Parser Framework

Last Update:

The Spirit Parser Framework is an object oriented recursive descent parser generator framework implemented using template metaprogramming techniques....

Word Count : 298

Left recursion

Last Update:

{Expression}}+{\mathit {Term}}} is directly left-recursive. A left-to-right recursive descent parser for this rule might look like void Expression() {...

Word Count : 2310

History of compiler construction

Last Update:

code. A recursive ascent parser implements an LALR parser using mutually-recursive functions rather than tables. Thus, the parser is directly encoded in...

Word Count : 6356

LR parser

Last Update:

parser loop in table-driven parsers. The fastest parsers use generated assembler code. In the recursive ascent parser variation, the explicit parse stack...

Word Count : 8128

Mutual recursion

Last Update:

and in some problem domains, such as recursive descent parsers, where the datatypes are naturally mutually recursive. The most important basic example of...

Word Count : 2009

XML

Last Update:

Pull parsing treats the document as a series of items read in sequence using the iterator design pattern. This allows for writing of recursive descent parsers...

Word Count : 7031

Recursive neural network

Last Update:

A recursive neural network is a kind of deep neural network created by applying the same set of weights recursively over a structured input, to produce...

Word Count : 954

RDP

Last Update:

detection program, for analysing genetic recombination Recursive descent parser, a type of top-down parser Remote Desktop Protocol, a Microsoft remote access...

Word Count : 160

GNU Bison

Last Update:

grammars. GCC started out using Bison, but switched to a hand-written recursive-descent parser for C++ in 2004 (version 3.4), and for C and Objective-C in 2006...

Word Count : 2306

GNU Compiler Collection

Last Update:

GCC started out using LALR parsers generated with Bison, but gradually switched to hand-written recursive-descent parsers for C++ in 2004, and for C and...

Word Count : 4911

Regular expression

Last Update:

of Perl 5.x regexes, but also allow BNF-style definition of a recursive descent parser via sub-rules. The use of regexes in structured information standards...

Word Count : 8915

Portable C Compiler

Last Update:

whom?] The first C compiler, written by Dennis Ritchie, used a recursive descent parser, incorporated specific knowledge about the PDP-11, and relied on...

Word Count : 1107

PDF Search Engine © AllGlobal.net