Flex/Bison Scripts for C++
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Feb 9 17:36:00 GMT 2017
On 9 February 2017 at 15:56, Lakshay Garg wrote:
> Hello GCC
>
> I am taking a compilers course and trying to build a compiler for C++.
> I have been trying to find a reliable lex and yacc script (one which
> does not cause any conflicts) which I can build upon but haven't found
> anything yet. Could you please point me to a source where I can find
> these files.
You could try looking at an ancient version of GCC, version 3.3 or
older. Since version 3.4.0 GCC has used a hand-written C++ parser, not
one based on lex or yacc.
Obviously if you look at an ancient GCC then you'll only find
something that supports an ancient dialect of C++, and will have
several parsing bugs (that's one of the reasons GCC changed to a
hand-written parser).
Be aware that the C++ grammar contains ambiguities that can only be
resolved by rules that are not contained in the grammar.
More information about the Gcc-help
mailing list