On Tue, Nov 9, 2010 at 9:38 PM, Shaping <shap...@charter.net> wrote: > I need to be able to write a parser in a > straightforward way (XStreams-style maybe) using a PEG (collection of BNF > productions) so that I can experiment efficiently with this idea. Does > anyone have any experience with PEGs in Factor?
Read the help for peg.ebnf. You can do this with the following in the listener: "peg.ebnf" about Also these blog posts: http://www.bluishcoder.co.nz/2007/11/embedded-grammars-in-factor.html http://www.bluishcoder.co.nz/2008/04/factor-parsing-dsl.html http://www.bluishcoder.co.nz/2008/06/parsing-javascript-with-factor.html The code in them is slightly out of date but combined with the peg.ebnf help you should be able to get the idea. There are a few peg.ebnf usage examples for a JavaScript grammar, a PL0 grammar and an expression calculator in the Factor source. My PDF of articles might have more up to date code examples than the blog posts: http://www.bluishcoder.co.nz/factor-articles.pdf Chris. -- http://www.bluishcoder.co.nz ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk