[antlr-interest] antlrworks "NoViableAlt" exception

Tom fivemiletom at gmail.com
Thu Nov 8 15:54:36 PST 2012


On Wed, Nov 7, 2012 at 8:45 PM, Jim Idle <jimi at temporal-wave.com> wrote:

> The interpreter is just a quick test of basic rules - it cannot do
> anything complicated so it will get confused a lot. Just ignore the
> interpreter and use the debug option, which will run the real thing.


I see. Thank you, Jim.


> Also,
> if you are building trees, then I would use real tokens in the lexer and
> not 'literals' in the parser.
>

OK, done that as well.
(I think that implies I have a statement like: tokenVocab=myGrammar. I am
not sure how the gui actually finds and uses the file myGrammar.g; but all
good as long as it works).



>
> Jim
>
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Tom
> Sent: Thursday, November 08, 2012 12:15 PM
> To: antlr-interest at antlr.org
> Subject: [antlr-interest] antlrworks "NoViableAlt" exception
>
> Hello,
>
> I am new to ANTLR, using version 3.4.
>
> Does anybody have an idea what could be causing the following discrepancy:
>
> When I use the GUI interpreter on an input I get some console errors
> below.
>
> Now I use the debugger on exactly the same input (copy/paste), the whole
> thing works:  whole ASTree is built as I want it.
>
> I have seen some posts about line ending characters and having to reset
> the token stream, but this all doesn't seem to apply here, does it?
>
>
> Thanks
> Tom
>
>
>
> console errors:
> ==
> [20:01:04] Interpreting...
> [20:01:04] problem matching token at 1:3 MismatchedTokenException(97!=34)
> [20:01:04] problem matching token at 1:4 NoViableAltException('a'@[1:1:
> Tokens : ( AND | COMMA | OR | T__26 | T__27 | T__28 | T__29 | T__30 |
> T__31
> | T__32 | T__33 | T__34 | T__35 | WS | Number | Exponent | String );])
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>


More information about the antlr-interest mailing list