Re: parsing ISO C++(1998/2003)



"Aaron Gray" <ang.usenet@xxxxxxxxx> wrote in message
<parthaspanda2005@xxxxxxxxx> wrote in message
No matter how many shots at it, I havent been
able to get bison/yacc to parse the C++ grammar
specified in the reference manual.

GLR (Bison has GLR) was ment to be the answer, although it is slow compared
to other techniques.

Elkhound and Elsa tried GLR approach and failed.

Failed? From what I hear, Elsa can parse virtually all of ANSI C++.
What's the failure, exactly?

All the major C++ parsers are hand coded, recursive decent and precedance
based binary ops.

Guess our DMS Software Reengineering Toolkit isn't a major C++ parser.
Nonetheless, it is NOT hand code. It uses
GLR to parse variety of C++ dialects (ANSI, GNU,
MS including 2005), with grammar rules taken pretty directly from
from ANSI standard (and adjusted according to dialects, etc.).
See http://www.semanticdesigns.com/Products/FrontEndsd/CppFrontEnds.html

How do I get the grammar in the manual
not to change much as well as pass under
bison/yacc?

Thats probably impossible.

Aaron

Use GLR. There are several proof by examples.
So this is very practical.

However, you'll find that there is an enormous amount of work to build
a working C++ front end above and beyond parsing.

If you think of parsing C++ as climbing foothills, getting the rest of
the front end right (preprocessor, name and type resolution, managing
the real dialects used, linking) is like climbing the Himalayas.
People don't seem to understand this very well. Maybe it because they
never get past parsing.

--
Ira Baxter, CTO
www.semanticdesigns.com

.



Relevant Pages

  • Re: parsing ISO C++(1998/2003)
    ... able to get bison/yacc to parse the C++ grammar ... Factoring and other smart tricks leave the grammar ... GLR was ment to be the answer, ...
    (comp.compilers)
  • Re: parsing ISO C++(1998/2003)
    ... GLR was ment to be the answer, ... Elsa can parse virtually all of ANSI C++. ... a working C++ front end above and beyond parsing. ...
    (comp.compilers)
  • parsing ISO C++(1998/2003)
    ... No matter how many shots at it, ... able to get bison/yacc to parse the C++ grammar ... Factoring and other smart tricks leave the grammar ... You can't parse it using a yacc parser ...
    (comp.compilers)