分享

c++

 quasiceo 2014-01-12

Someone already made an ANTLR grammar for the Lua language:

http://www./grammar/1178608849736/Lua.g

I've used ANTLR on a couple projects with good results. It will generate a C (ANTLR v3) or C++ (ANTLR v2) parser including AST generation if you ask for it.

answered Jan 1 '12 at 1:29
John Zwinck
33.5k34286
1  
Why does v2 produce C++ while v3 produces C? –  Seth Carnegie Jan 1 '12 at 3:16
2  
And interesting question. v2 had several targets, including C++, Java, and C#. v3 supports C, Java, C#, Python, and Objective C. While it may be obvious why they added Python and Objective C, it's not so clear why they abandoned C++. One ANTLR maintainer said several times that he'd write a C++ target for ANTLR v3, but never did. Maybe others haven't tried because the cookie is wet (blogs./b/oldnewthing/archive/2009/12/01/9930480.aspx). How did the C++ target from v2 "disappear" from v3? That's because they redesigned the target API to make it easier to add languages. –  John Zwinck Jan 1 '12 at 14:12

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约