parsing based on BNF?

Uche Ogbuji uche at ogbuji.net
Tue Feb 27 00:04:49 EST 2001


D-Man wrote:
> 
> On Sat, Feb 24, 2001 at 10:24:58PM +0000, Uche Ogbuji wrote:
> |
> | I'm also curious to know if there is such a beast for Python or C/C++.
> |
> 
> If you want to get C code as the result, lex + yacc is a good
> combination.  With lex (flex) you specify regexes that describe the
> various tokens in your language.  With yacc (bison) you specify the BNF
> in terms of the lex tokens and what actions the parser should take
> when that expression is found.

Not what I was talking about.

Lex uses regular expressions and a proprietary glue language.

Yacc is based on BNF, but not quite.

I'm quite familiar with all the various scanners and parsers, which is
why I asked my question.  I do not know of one that implements plain BNF
(or EBNF to provide some lexical specifications).  This would have been
useful in implementing the many little languages I have: XPath, OQL,
ODL, etc. which are specified in BNF.

So far I've either had to convert them to lex or yacc, a tedious
process, or to our XML-based BisonGen format.


-- 
Uche Ogbuji
Personal:   uche at ogbuji.net		http://uche.ogbuji.net
Work:       uche.ogbuji at fourthought.com	http://Fourthought.com



More information about the Python-list mailing list