help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: confusing bison error


From: John P. Hartmann
Subject: Re: confusing bison error
Date: Sat, 28 Nov 2020 11:27:53 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

His goof was to specify '=' (three characters) in flex. So the = token never got to the parser.

On 11/28/20 09:49, Akim Demaille wrote:
Hi Jot,

Le 27 nov. 2020 à 11:20, Jot Dot <jotdot@shaw.ca> a écrit :

What do you mean? It did display "go to state 31", but did not? Could you 
please provide us with the full trace? Also, have you tried to enable the Flex traces, 
just in case.

My input string is "CONST\n\trange = 1..10;\n"
It picked up the identifier "range" and should have picked up the '=' (and then 
goto state 31) but says it go an error token instead.

Your reports are too hard to read.   For instance it's super unclear in your messages 
whether you *expected* the parser to report "go to state 31", or whether it did 
display that, and did something different afterwards.

Please, next time, give me *verbatim* output, a *text* copy-paste from your 
run.  And provide with enough context, not just one line.  Give the full traces.

I don't know what you refer to in " enable the Flex traces ".

Look for yy_flex_debug in the doc.

Can you show how you handle '='?

'=' { return gen::Parser::symbol_type(*yytext, loc); }

If your traces tell you that the parser did not see `=`, then it does mean 
that: it did not receive it.  So you have to look carefully at this rule, and 
you should enable the Flex trace to make sure that your scanner really does 
what you think it does.

I'm not using the raw option for the parser.

Good.  It cannot work with it the way you wrote it.

FWIW, I prefer to explicitly "continue;" in these cases.

I'm a flex/bison newbie. Can you explain? (Not sure of "continue").


[ \t\r\n]+ ; /* whitespace */

=>

[ \t\r\n]+  continue;


Well, not totally true. A couple years back I tried ANTLR but it was way too 
bug-ridden to be of any use.

I find this hard to believe.  ANTLR's reputation is solid.

And the bug-report end was a bit uncaring and hostile imo. I wasted too much time with it.

I don't understand either. You don't play with start conditions, do you?

The only stuff is was I found on the web:

So that's why your scanner is not complete: you don't have a catch-clause for 
these start conditions.


Cheers!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]