For Programmers: Free Programming Magazines  


Home > Archive > Compilers > February 2006 > generating recursive parsers from grammars.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author generating recursive parsers from grammars.
Lowell Thomas

2006-02-20, 9:57 pm

You might have a look at APG, an ABNF Parser Generator tool that I have
written (www.coasttocoastresearch.com). Its parsers use a recursive-decent
algorithm and as far as I can determine they can handle any context-free
grammar. With ABNF left recursion can be eliminated via the repetition (*)
operator. Other types of recursion, except for cyclical recursion and
infinite strings, are not a problem. It uses a hard-coded disambiguation
rule to resolve ambiguities, but the source code is available other rules
can be implemented. It is not a mainstream method but I have found it to
work well for all grammars that I have tried so far, including
dangling-else, expressions and an expression/declaration abstraction that
requires semantic predicates.

I'd be interested in hearing about your experience with APG if you decide to
give it a try.

Lowell Thomas

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com