Integrating ANTLR 4 in a C++ application

后端 未结 4 1073
误落风尘
误落风尘 2021-01-05 09:40

Recently I picked up a copy of The Definitive ANTLR 4 Reference and since I am sophisticated when it comes to working with grammars and languages I wanted to wo

4条回答
  •  不知归路
    2021-01-05 10:34

    To John G. answer

    • I agree that ANTLR3 C target is very hacking. Me, C/C++ expert with 20 years, was not able even guess how to use it without answers from author. Yes, ideas was quite good, but without docs near to impossible to understand.

    • I not agree that main trouble with exceptions. In times of ANTLR2 and C++ implementation fir v2, exceptions did exists ... And there was opinion that if to remove exceptions it will be faster. In v3 they have try do that, but ...

    • But speed have not became better. We was in hope switch from ANTRL2 to ANTLR3 in our Valentina Database engine, we have spend months re-writing to v3 grammar, and ... zero speed up. Just zero. So we use up to now v2 of ANTLR.

    • I think main issue if speed in ANTLR is the fact that for each rule it produce separate function. Yes this is its strong side, and this is its weak side.

    In the v4 Terrence have invent how to use state machines in Lexer. If we could get that for parsers also. I think in ideal, ANTLR could produce functions as now, while we develop grammar, and state machines for release. But this is a dream so far.

提交回复
热议问题