ANTLR 3.5 eclipe interpreter vs Compiled code

60 views
Skip to first unread message

ANTLRNEWBIE

unread,
Mar 17, 2013, 11:16:00 AM3/17/13
to antlr-di...@googlegroups.com
Hi,

When I run a test and view a parse tree for my ANTLR grammar through the interpreter that's provided with the ANTLR eclipse plugin, everything looks good. That is, I can see that my lexer tokens have matched up with my parser rules. However, when I run the compiled Parser code, I get mismatched character exceptions that get thrown out and don't become part of my parse rules. What is the difference in settings between the interperter and my compiled grammar? That is, what is the interpreter doing to trap the mismatches and decide to correctly place them with my parser rules?

Thanks

Jim Idle

unread,
Mar 17, 2013, 11:32:24 AM3/17/13
to antlr-di...@googlegroups.com
Assuming that you mean V3 and not v4, you should not use the
interpreter and the eclipse plugin is quite out of date I think. The
runtime errors will be correct.

Without seeing the errors or your rules, there isn't much else we can tell you.
> --
> You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

ANTLRNEWBIE

unread,
Mar 17, 2013, 12:53:00 PM3/17/13
to antlr-di...@googlegroups.com
On Sunday, March 17, 2013 11:32:24 AM UTC-4, Jim Idle wrote:
> Assuming that you mean V3 and not v4, you should not use the
>
> interpreter and the eclipse plugin is quite out of date I think. The
>
> runtime errors will be correct.
>
>
>
> Without seeing the errors or your rules, there isn't much else we can tell you.
>
>
>
> On Mar 17, 2013, at 23:16, ANTLRNEWBIE wrote:
>
>
>
> > Hi,
>
> >
>
> > When I run a test and view a parse tree for my ANTLR grammar through the interpreter that's provided with the ANTLR eclipse plugin, everything looks good. That is, I can see that my lexer tokens have matched up with my parser rules. However, when I run the compiled Parser code, I get mismatched character exceptions that get thrown out and don't become part of my parse rules. What is the difference in settings between the interperter and my compiled grammar? That is, what is the interpreter doing to trap the mismatches and decide to correctly place them with my parser rules?
>
> >
>
> > Thanks
>
> >
>
> >
>
> >
>
> > --
>


I'm being purposely vague because I've seen this with a number of different grammar tests that I've run. The interpreter seems to take the mismatched tokens and add them to the rule, which is what I want, but the compiled code doesn't. So it appears that the interpreter is trapping those exceptions and using the tokens to build the parse tree instead of throwing them out. I *believe* eclipse is using ANTLR 3.5 and that is the runtime jar that I am using well.

Would you recommend going to ANTLR 4.0 and trying to take advantage of new features that might help me consume those mismatched tokens and add them to my rule or some such thing?

Thanks

Reply all
Reply to author
Forward
0 new messages