I was wondering if there are any "table driven" PEG/packrat based parsers.
In looking at the url
   
http://en.wikipedia.org/wiki/Comparison_of_parser_generators#Parsing_Expression_Grammars
I see that there are four implementation styles for a PEG parser:
Packrat, Recursive Descent, Parsing Machine and PEG parser interpreter.
As far as I know, all the Packrat and Recursive Descent varieties generate
code. If I am wrong please correct me.
Parsing Machine seems to generate a byte code for a PEG virtual machine.
   http://www.inf.puc-rio.br/~roberto/docs/ry08-4.pdf.
The PEG parser interpreter seems to just interpret the PEG directly via a
set of recursive functions.
   http://fdik.org/pyPEG/

Can one create a table driven PEG/packrat parser? What would such a program
look like? Does this question even make sense?

I know Terrance Parr wrote in his "ANTLRWorks" draft paper:

ANTLR provides the power of a PEG with the semantic action flexibility and low overhead of a traditional LL-based parser. ANTLR not only supports manual backtracking via syntactic predicates, but supports an automatic backtracking option that tells ANTLR to backtrack at runtime if LL(*) static analysis fails.

However, ANTLR generates code (aside from it not strictly being a Packrat parser). Perhaps there is no reason why it could not be made to generate a table and
support code.

I am also aware of the paper by Roman R. Redziejowski titled
"Applying Classical Concepts to Parsing Expression Grammar", which seems to attempt to define the FIRST and FOLLOW sets for PEGs. (Caveat, as I have not
read this paper yet.)

So, are there any "table driven" PEG based parsers?

One reason I am asking this question is that I was wondering how to use PEGs in a dynamic context. If you read in a grammar and generate a table, you now have a data driven process which can be used at runtime. Is there someway to use PEGs in a dynamic context, w/o having to generate code? (The Lua PEG virtual machine and the pyPeg mentioned above seem to be two approaches to this problem.)

Thanks for your time.

_bernhard



_______________________________________________
PEG mailing list
PEG@lists.csail.mit.edu
https://lists.csail.mit.edu/mailman/listinfo/peg

Reply via email to