Discussion:
Is there a C++ grammar for ANTLR?
Zhaohui Yang
2012-12-01 17:23:31 UTC
Permalink
Hi,

I guess this question have been asked for thousands of times. But I can't
find an answer anywhere...

So I'd ask a more general question. Does anyone know of any publicly
available grammar definition of any version of C++, that could be converted
to ANTLR syntax, with less effort than extending the C grammar distributed
with ANTLR examples?

Thank you in advance.
--
Regards,

Yang, Zhaohui

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
Eric
2012-12-01 17:40:58 UTC
Permalink
Yes I asked a similar question a long time ago.

Some people do have ANTLR C++ grammars but I don't know of any that are
public. If I remember correctly Ter did one for ANTLR 2, but it was never
brought forward for ANTLR 3.x or 4.x

The best place to start would be using the grammars in the C++ reference
manuals, which can also be found online, don't remember where. Since C++
was not designed for easy parsing, there are place in the grammar that will
require the use of ANTLR predicates to get around. Ter mentions solutions
to some of them in the ANTLR 3.x book he wrote.

Also, there are others here who can shed some light on the problem. Search
the Antlr archive and you will find several interesting post that will help
you. http://antlr.markmail.org/



Regards, Eric
Post by Zhaohui Yang
Hi,
I guess this question have been asked for thousands of times. But I can't
find an answer anywhere...
So I'd ask a more general question. Does anyone know of any publicly
available grammar definition of any version of C++, that could be converted
to ANTLR syntax, with less effort than extending the C grammar distributed
with ANTLR examples?
Thank you in advance.
--
Regards,
Yang, Zhaohui
List: http://www.antlr.org/mailman/listinfo/antlr-interest
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
Aurelian Melinte
2012-12-01 21:51:38 UTC
Permalink
http://www.antlr.org/grammar/1295920686207/antlr3.2_cpp_parser4.1.0.zip
http://www.antlr.org/grammar/list.html

There was also a 4.1.1 version (no grammar changes) that got nuked off
the site last week-end. The upload does not work, email me directly if
you want it.

Thanks,
Aurelian
Post by Eric
Yes I asked a similar question a long time ago.
Some people do have ANTLR C++ grammars but I don't know of any that are
public. If I remember correctly Ter did one for ANTLR 2, but it was never
brought forward for ANTLR 3.x or 4.x
The best place to start would be using the grammars in the C++ reference
manuals, which can also be found online, don't remember where. Since C++
was not designed for easy parsing, there are place in the grammar that will
require the use of ANTLR predicates to get around. Ter mentions solutions
to some of them in the ANTLR 3.x book he wrote.
Also, there are others here who can shed some light on the problem. Search
the Antlr archive and you will find several interesting post that will help
you. http://antlr.markmail.org/
Regards, Eric
Post by Zhaohui Yang
Hi,
I guess this question have been asked for thousands of times. But I can't
find an answer anywhere...
So I'd ask a more general question. Does anyone know of any publicly
available grammar definition of any version of C++, that could be converted
to ANTLR syntax, with less effort than extending the C grammar distributed
with ANTLR examples?
Thank you in advance.
--
Regards,
Yang, Zhaohui
List: http://www.antlr.org/mailman/listinfo/antlr-interest
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
Eric
2012-12-01 21:54:52 UTC
Permalink
Thanks, Eric
http://www.antlr.org/grammar/**1295920686207/antlr3.2_cpp_**
parser4.1.0.zip<http://www.antlr.org/grammar/1295920686207/antlr3.2_cpp_parser4.1.0.zip>
http://www.antlr.org/grammar/**list.html<http://www.antlr.org/grammar/list.html>
There was also a 4.1.1 version (no grammar changes) that got nuked off the
site last week-end. The upload does not work, email me directly if you want
it.
Thanks,
Aurelian
Post by Eric
Yes I asked a similar question a long time ago.
Some people do have ANTLR C++ grammars but I don't know of any that are
public. If I remember correctly Ter did one for ANTLR 2, but it was never
brought forward for ANTLR 3.x or 4.x
The best place to start would be using the grammars in the C++ reference
manuals, which can also be found online, don't remember where. Since C++
was not designed for easy parsing, there are place in the grammar that will
require the use of ANTLR predicates to get around. Ter mentions solutions
to some of them in the ANTLR 3.x book he wrote.
Also, there are others here who can shed some light on the problem. Search
the Antlr archive and you will find several interesting post that will help
you. http://antlr.markmail.org/
Regards, Eric
Post by Zhaohui Yang
Hi,
I guess this question have been asked for thousands of times. But I can't
find an answer anywhere...
So I'd ask a more general question. Does anyone know of any publicly
available grammar definition of any version of C++, that could be converted
to ANTLR syntax, with less effort than extending the C grammar distributed
with ANTLR examples?
Thank you in advance.
--
Regards,
Yang, Zhaohui
List: http://www.antlr.org/mailman/**listinfo/antlr-interest<http://www.antlr.org/mailman/listinfo/antlr-interest>
http://www.antlr.org/mailman/**options/antlr-interest/your-**
email-address<http://www.antlr.org/mailman/options/antlr-interest/your-email-address>
List: http://www.antlr.org/mailman/**listinfo/antlr-interest<http://www.antlr.org/mailman/listinfo/antlr-interest>
Unsubscribe: http://www.antlr.org/mailman/**options/antlr-interest/your-*
*email-address<http://www.antlr.org/mailman/options/antlr-interest/your-email-address>
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address
Zhaohui Yang
2012-12-02 01:15:51 UTC
Permalink
thank you all for the great help. I have good start point now y:)
在 2012-12-2 上午5:54,"Eric" <***@gmail.com>写道:

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antl

Loading...