|
Boost : |
From: Kevin S. Van Horn (kevin.vanhorn_at_[hidden])
Date: 2002-02-26 12:28:23
Doees anyone know of a C++-friendly version of yacc, or, better yet, a
version of yacc that produces a generic algorithm (e.g., take as input a
pair of InputIterators)? Yacc / bison as it stands is quite unfriendly to
C++, as you cannot put C++ objects on the evaluation stack, which means
that you can't always get objects properly destroyed. You can
partially get around this by putting only pointers on the evaluation
stack, and having the code that accompanies a production rule be
responsible for managing the objects on which it operates, but this scheme
breaks down when it comes to error processing -- values get popped off of
the evaluation stack without giving you any opportunity to process them.
The Spirit parser is not what I am looking for, as it is limited to
recursive-descent parsing, and is hence unsuitable for many applications
(say, parsing a C++ program).
On a similar note, although the GNU version of lex (flex) does support
C++, it doesn't support generic programming (it wants to have an iostream
as input.) Again, does anyone know of a version of lex that supports
generic programming?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk