Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The questions when i try to translate java class to antlr3 grammer file. #208

Open
walkertest opened this issue May 11, 2022 · 3 comments
Open

Comments

@walkertest
Copy link

walkertest commented May 11, 2022

The context Link:antlr/antlr4#3652

Env: antlr 3.5
Run commond:  java -jar antlr-3.5-complete.jar TarsParser.g

I have tralated the lexer file successfully.: https://github.com/walkertest/TarsJava/blob/feature/antlrfind/tools/tars-maven-plugin/src/main/resources/antlr/TarsLexer.g

The parser file was almost found back:https://github.com/walkertest/TarsJava/blob/feature/antlrfind/tools/tars-maven-plugin/src/main/resources/antlr/TafParser.g

The remaining questions are:
First:
image
const_initializer func was different like this.

Second:
image
The Follow bitset define index was a little differant like this.

Third:
image
The order of some valiables which defined in func was differant.

@walkertest
Copy link
Author

@parrt

I am new to antlr and had tried by best to solve these problems myself.
Please give some guide.

Thanks first.

@kaby76
Copy link

kaby76 commented May 11, 2022

I think the numbers appended at the end of the constant declaration is likely because there are some missing token definitions, or that they are out of order from the original grammar. I also think the same for the other two observed differences. Did you try your recovered grammar? Also, why did you revert back to Antlr3 from Antlr4?

@walkertest
Copy link
Author

walkertest commented May 11, 2022

I think the numbers appended at the end of the constant declaration is likely because there are some missing token definitions, or that they are out of order from the original grammar

I agree with u. Or may be the anltr3 version older(I have tried antlr3 and antlr 3.5.3).
Now TarsParser file was almost found back. I don't know what make the remaining differences.

Did you try your recovered grammar?

Yes, i try to recover the grammer.

why did you revert back to Antlr3 from Antlr4?

Because the original version is antlr3.5(maybe older.)

My plan is get back the antlr3 file completely and then change to antlr4.
Doing like this maybe more safely for the tars framework.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants