Global Information Lookup Global Information

Packrat parser information


Packrat parser
ClassParsing grammars that are PEG
Data structureString
Worst-case performance or without special handling of iterative combinator
Best-case performance
Average performance
Worst-case space complexity

The Packrat parser is a type of parser that shares similarities with the recursive descent parser in its construction. However, it differs because it takes parsing expression grammars (PEGs) as input rather than LL grammars.[1]

In 1970, Alexander Birman laid the groundwork for packrat parsing by introducing the "TMG recognition scheme" (TS), and "generalized TS" (gTS). TS was based upon Robert M. McClure's TMG compiler-compiler, and gTS was based upon Dewey Val Schorre's META compiler-compiler. Birman's work was later refined by Aho and Ullman; and renamed as Top-Down Parsing Language (TDPL), and Generalized TDPL (GTDPL), respectively. These algorithms were the first of their kind to employ deterministic top-down parsing with backtracking.[2][3]

Bryan Ford developed PEGs as an expansion of GTDPL and TS. Unlike CFGs, PEGs are unambiguous and can match well with machine-oriented languages. PEGs, similar to GTDPL and TS, can also express all LL(k) and LR(k). Bryan also introduced Packrat as a parser that uses memoization techniques on top of a simple PEG parser. This was done because PEGs have an unlimited lookahead capability resulting in a parser with exponential time performance in the worst case.[2][3]

Packrat keeps track of the intermediate results for all mutually recursive parsing functions. Each parsing function is only called once at a specific input position. In some instances of packrat implementation, if there is insufficient memory, certain parsing functions may need to be called multiple times at the same input position, causing the parser to take longer than linear time.[4]

  1. ^ Ford, Bryan (2006). "Packrat Parsing: Simple, Powerful, Lazy, Linear Time". arXiv:cs/0603077.
  2. ^ a b Ford, Bryan (2004-01-01). "Parsing expression grammars". Proceedings of the 31st ACM SIGPLAN-SIGACT symposium on Principles of programming languages. POPL '04. New York, NY, USA: Association for Computing Machinery. pp. 111–122. doi:10.1145/964001.964011. ISBN 978-1-58113-729-3. S2CID 7762102.
  3. ^ a b Flodin, Daniel. "A Comparison Between Packrat Parsing and Conventional Shift-Reduce Parsing on Real-World Grammars and Inputs" (PDF).
  4. ^ Mizushima, Kota; Maeda, Atusi; Yamaguchi, Yoshinori (2010-05-06). "Packrat parsers can handle practical grammars in mostly constant space". Proceedings of the 9th ACM SIGPLAN-SIGSOFT workshop on Program analysis for software tools and engineering. ACM. pp. 29–36. doi:10.1145/1806672.1806679. ISBN 978-1-4503-0082-7. S2CID 14498865.

and 12 Related for: Packrat parser information

Request time (Page generated in 0.8037 seconds.)

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

Parsing expression grammar

Last Update:

PEG-directed parsing stage. Therefore left-recursion is practically less likely to trouble a PEG packrat parser than, say, an LL(k) context-free parser, unless...

Word Count : 6426

Parsing

Last Update:

parser LALR (look-ahead LR) parser Operator-precedence parser SLR (Simple LR) parser Simple precedence parser Packrat parser: a linear time parsing algorithm...

Word Count : 4857

CYK algorithm

Last Update:

to a constant-size grammar. GLR parser Earley parser Packrat parser Inside–outside algorithm Grune, Dick (2008). Parsing techniques : a practical guide...

Word Count : 2179

GLR parser

Last Update:

Reengineering Toolkit GNU Bison, a parser generator that can create LALR and GLR parsers Packrat parser, another parse the can parse ambiguous and nondeterministic...

Word Count : 850

Memoization

Last Update:

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 to the...

Word Count : 3744

Comparison of parser generators

Last Update:

2023-11-30. "The Lezer Parser System". "Building a ShopifyQL Code Editor". Shopify. Retrieved 2023-12-06. "Sponsoring the Lezer parser system | Tines". www...

Word Count : 1106

List of algorithms

Last Update:

parser LALR (look-ahead LR) parser Operator-precedence parser SLR (Simple LR) parser Simple precedence parser Packrat parser: a linear time parsing algorithm...

Word Count : 7843

Timeline of algorithms

Last Update:

complex systems 2002 – Packrat parser developed for generating a parser that parses PEG (Parsing expression grammar) in linear time parsing developed by Bryan...

Word Count : 2097

PackCC

Last Update:

efficiency by packrat parsing, Supports direct and indirect left-recursive grammar rules, Generates a thread-safe and reentrant parser, Consists of just...

Word Count : 404

Syntactic predicate

Last Update:

predicate to appear anywhere within a production. Moreover, Ford invented packrat parsing to handle these grammars in linear time by employing memoization, at...

Word Count : 1798

Formal grammar

Last Update:

Technologies, 1993. (Revised version of above report.) Ford, Bryan, Packrat Parsing: a Practical Linear-Time Algorithm with Backtracking, Master’s thesis...

Word Count : 3431

PDF Search Engine © AllGlobal.net