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

sample problems #76

Open
BINARYGARRY opened this issue Jul 10, 2023 · 4 comments
Open

sample problems #76

BINARYGARRY opened this issue Jul 10, 2023 · 4 comments

Comments

@BINARYGARRY
Copy link

Hi, I'm running the sample in antlr tools and getting these comments.
2:9 token recognition error at: '+'
2:10 extraneous input 'foo' expecting ';'

I've made no changes and just clicked the run button. The '+' makes sense to me since it's not in the lexer. It does build the tree but 'foo' is highlighted in the tree and input . Is this meant to be a learning exercise or possibly a bug?

My apologies if this has already been explained.
Thx
Garry

@kaby76
Copy link
Collaborator

kaby76 commented Jul 10, 2023

Which grammar? Expr.g4 or JavaLexer.g4/JavaParser.g4? Those are the only two discussed. https://github.com/antlr/antlr4-tools#parsing-using-interpreter

@BINARYGARRY
Copy link
Author

sorry I wasn't more clear . it's the default sample
http://lab.antlr.org/

@kaby76
Copy link
Collaborator

kaby76 commented Jul 11, 2023

The default example at lab.antlr.org is supposed to contain the error. It's a demo of how it reports an error. If you change the input line a=3+foo; to a = 3 and 2;, then run the parse, it succeeds.

@BINARYGARRY
Copy link
Author

ok that matches the rules.
constructive criticism - that's confusing for someone starting out.
Also a really cool addition would be to include the virtuals and overrides based on those rules

anyway, thanks for helping me.
Great product and appreciate the teams efforts.

Garry

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