From: James Kanze (kanze_at_[hidden])
Date: 2002-03-03 09:26:32
Douglas Gregor <gregod_at_[hidden]> writes:
|> > 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).
|> As Dave Abrahams already mentioned, several of the better C++
|> parsers uses recursive descent parsing.
Strictly speaking, this isn't true; you cannot parse C++ using recursive
descent. Most C++ are based on a hand written recursive descent parsing
strategy, however, because it is easier to break out of the idiom in
special cases and use ad hoc solutions.
|> This is generally because recursive descent parsers handle context
|> sensitivity and arbitrary lookahead _much_ better than any
|> Yacc-based solution.
Formally, recursive descent doesn't allow arbitrary look ahead at all.
On the other hand, it is far easier to add backtracking to a recursive
descent parser than to any other type -- the results aren't formally
recursive descent, even if the initial analysis and coding are based on
-- James Kanze mailto:kanze_at_[hidden] Conseils en informatique orientée objet/ Beratung in objektorientierter Datenverarbeitung Ziegelhüttenweg 17a, 60598 Frankfurt, Germany Tel. +49(0)179 2607481
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk