On Mon, Nov 15, 2010 at 11:48:29AM -0700, Jon Rafkind wrote: > In my scheme packrat parser generator I define everything with macros. > Its somewhat simpler in that I don't have to do extra parsing and I get > the benefit of using macro technology to process the Peg. > > The generator: https://github.com/kazzmir/Pegs/blob/master/peg.rkt > An example usage: > https://github.com/kazzmir/Pegs/blob/master/peg-tests/calculator.ss >
Jon, I've added your packrat parser to the "See Also" on the documentation for my parser: http://wiki.call-cc.org/eggref/4/genturfahi#see-also Since Tony's parser was documented as a "Similar Work," I've also added both of our parsers to the cl-peg entry on cliki.net: http://www.cliki.net/cl-peg -Alan > On 11/15/2010 07:32 AM, Alan Post wrote: > > I'm implementing a packrat parser in Scheme. I'm at the point of > > writing a bootstrap parser in Scheme for PEG, and my bootstrap > > parser is basically working. > > > > I haven't yet decided on the syntax for embedding code in the > > parser. My only example for doing this is peg/leg: > > > > http://piumarta.com/software/peg/peg.1.html > > > > which encloses code in {} brackets and permits references to parts > > of the parse tree with <>: > > > > { action } > > Curly braces surround actions. The action is arbitray C source > > code to be executed at the end of matching. Any braces within > > the action must be properly nested. Any input text that was > > matched before the action and delimited by angle brackets (see > > below) is made available within the action as the contents of > > the character array yytext. The length of (number of characters > > in) yytext is available in the variable yyleng. (These variable > > names are historical; see lex(1).) > > > > < An opening angle bracket always matches (consuming no input) and > > causes the parser to begin accumulating matched text. This text > > will be made available to actions in the variable yytext. > > > > > A closing angle bracket always matches (consuming no input) and > > causes the parser to stop accumulating text for yytext. > > > > What else is out there? Is this something reasonably standard or does > > every tool do something different? > > > > -Alan > > > _______________________________________________ > PEG mailing list > PEG@lists.csail.mit.edu > https://lists.csail.mit.edu/mailman/listinfo/peg -- .i ko djuno fi le do sevzi _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg