How to change ANTLR2 to ANTLR3

I am developing a practical Java task with ANTLR 3.4. The instructions that are given to us in ANTLR 2.7 and the changes regarding version 3. I found that the pages show some differences, but not the ones they are looking for.

In ANTLR 2.7, MiToken can load a class as follows:

analex.setTokenObjectClass ("MiToken")** 

What will be the equivalent in ANTLR 3.4? This option does not exist in this version.

+4
source share
1 answer

In ANTLR 3.4, the setTokenObjectClass (Sting) method does not exist. You should look at this page (this is the ANTLR 3.4 wiki):

http://www.antlr.org/wiki/pages/viewpage.action?pageId=1844

We use the same PDF file instructions, you use C # as the target language, but we use Java as the target language. I can do this because another student in the same class will find the method name to override (the method name to override in ANTLR v3.4 is emit ().

+1
source

Source: https://habr.com/ru/post/1438254/


All Articles