[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison and $ (dollarsign) token at the end
From: |
Hans Aberg |
Subject: |
Re: Bison and $ (dollarsign) token at the end |
Date: |
Thu, 4 Jul 2002 18:55:53 +0200 |
At 15:38 +0200 2002/07/04, address@hidden wrote:
>I run bison -v "myfile.y" and got output where last two rules I can't
>understand:
>state 15
> $ go to state 16
>state 16
> $ go to state 17
>state 17
>
> $default accept
huh what $ is for? Is
>it some kind of "end of input"?
Yes, the parser algorithm requires a token end-marker which is called $.
>If parser is in state 15 it needs two $ to accept...
Not really: The $ token lies in the input lookahead unaltered. For other
tokens there are two operation "shift" = put onto stack, and "reduce" =
apply a rule to top of stack. For $ it only says "go to state n", so
nothing happens with it.
>How can I make yylex (flex++) make returns twice (-1)?
So this is not needed. Otherwise, the Bison parser is accepting values <= 0
as end token.
For help with Flex use the
Help-flex mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/help-flex
>Waiting for reply...
Enjoy!
Hans Aberg