[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison and $ (dollarsign) token at the end
From: |
Grzegorz_Szostak |
Subject: |
Re: Bison and $ (dollarsign) token at the end |
Date: |
Fri, 5 Jul 2002 09:18:27 +0200 |
>>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.
OK, so why I get message: parse error, expecting `$' ?
My rules comes here:
expression
: {}
| lines
;
lines
: line
| lines line
;
line
: def_decl
| assig
| val
| operation
;
def_decl
: VAR VAR_NAME EQU NUMBER {
(*pVars)[(*$1)] + (*pVars)[(*$3)];
$$ = &((*pVars)[(*$1)].getString());
}
;
assig
: VAR_NAME EQU NUMBER
operation
: VAR_NAME PLUS VAR_NAME
;
val
: VAR_NAME
;
When I make input succefying def_decl, parser puts " " - white space on
output...
Why?
Regardless
GSZ