Hi,
I'm still learning AntLr, but something is bothering me, maybe someone
here can explain this.
Given a very simple test grammar like:
prog
: STRING;
STRING
: '"' ( '\"' | ~('"') )* '"';
I debug using "test" as input, and it works fine and shows me a tree
like: root -> prog -> "test"
But from the interpreter, it shows me: <grammar X> -> prog ->
MismatchedTokenException(-1!=4)
and the console says:
[17:27:48] Interpreting...
[17:27:48] problem matching token at 1:2 MismatchedTokenException(116!=34)
[17:27:48] problem matching token at 1:3 MismatchedTokenException(101!=34)
[17:27:48] problem matching token at 1:4 MismatchedTokenException(115!=34)
[17:27:48] problem matching token at 1:5 MismatchedTokenException(116!=34)
[17:27:48] problem matching token at 1:6 NoViableAltException('?'@[()*
loopback of 11:8: ( '\"' | ~ ( '"' ) )*])
I am aware that the debug and interpreter trees are not the same, and
that the interpreter does not support some things like actions etc, but
still this simple syntax should work right?
Actually, I was trying to create a more complex grammar, until I started
to see these exceptions. Made me crazy for days until I realized the
actual compiled code was working fine.
So, is this because the interpreter is not the same as the code
generated by antlr?
Or do I need to add something to my grammar to be able to test inputs
using the interpreter?
Or the interpreter is in beta stage and I should not believe anything it
says for now?
Thanks!
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"il-antlr-interest" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---