[antlr-interest] found a c++ grammar xml, convert to antlr grammar?

Ludwig Maes ludwig.maes at gmail.com
Thu Mar 8 19:10:16 PST 2012

Hi, I found a C++ grammar at download section of


its in xml form, but I guess it should be easy to write a grammar to
parse this xml to antlr grammar notation (I have not done so yet)...

I would like to avoid a target language as far as possible (I
personally find it hard to interpret/use a "polished" grammar full of
actions and detail handling) and would like to pass it to a tree
grammar before any actions are applied (is this possible?). I inted to
use java as target language as soon as actions are unavoidable (there
already is an antlr grammar with c++ target)...

Theres already some issues I dont understand in the xml: theres
multiple sections (do they refer to certain parsing passes? or are
they just grouped by topic?), and the literal "while" seems to be
present in both the keyword and iteration rules...

Another problem I have is: how should things like #include be handled?
to call the translation unit rule these files should already be
included, so it seems unavoidable to have actions that include these
files like a preprocessor would? pretty confusing all

Anyone else interested in collaborating? i.e. creating a grammar to
convert this xml to grammar notation, and then finding out what the
sections mean?
I think once the sections have their own antlr grammar notations, we
could more easily see which sections depend on others, etc....


More information about the antlr-interest mailing list