Packrat parsing is a newly popular technique for efficiently implementing recursive descent parsers. Packrat parsing avoids the potential exponential costs of recursive descent parsing with backtracking by ensuring that each production rule in the grammar is tested at most once against each position in the input stream. This paper argues that (a) packrat parsers can be trivially implemented using a combination of definite clause grammar rules and memoing, and that (b) packrat parsing may actually be significantly less efficient than plain recursive descent with backtracking, but (c) memoing the recognizers of just one or two nonterminals, selected in accordance with Amdahl's law, can sometimes yield speedups. We present experimental evidence to support these claims. © Springer-Verlag Berlin Heidelberg 2008.
CITATION STYLE
Becket, R., & Somogyi, Z. (2007). DCGs + Memoing = Packrat parsing but is it worth it? In Lecture Notes in Computer Science (including subseries Lecture Notes in Artificial Intelligence and Lecture Notes in Bioinformatics) (Vol. 4902 LNCS, pp. 182–196). https://doi.org/10.1007/978-3-540-77442-6_13
Mendeley helps you to discover research relevant for your work.