[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Problem in grammar
From: |
Godeau Julien |
Subject: |
RE: Problem in grammar |
Date: |
Mon, 21 Feb 2011 08:57:29 +0100 |
Hello,
Thanks for your answer.
You're right, I wanted to simplify the thing and I forgot to put the 'SIGNAL'
token in signal definition:
signal : SIGNAL { $$ = $2; }
| '(' signal ')' { $$ = $2; }
| full_function_call { $$ = $1; }
| OPERATOR1 signal %prec UNARY { $$ = ... }
| signal OPERATOR1 signal { $$ = ... }
| signal OPERATOR2 signal { $$ = ... }
| signal OPERATOR1 float_value { $$ = ... }
| float_value OPERATOR1 signal { $$ = ... }
| signal OPERATOR2 float_value { $$ = ... }
| float_value OPERATOR2 signal { $$ = ... }
;
"My_other_signal" is seen as a SIGNAL token, being recognized by its name
thanks to a list of existing signals.
"IDENTIFIER" token is a new name that the system does not know neither for a
variable nor for a signal.
Julien
-----Message d'origine-----
De : Joel E. Denny [mailto:address@hidden
Envoyé : dimanche 20 février 2011 16:06
À : Godeau Julien
Cc : address@hidden
Objet : Re: Problem in grammar
On Tue, 15 Feb 2011, Godeau Julien wrote:
> My_var = 3. + 1.
>
> My_signal = 4. + My_other_signal
>
> Mysignal = My_other_signal + 4.
>
>
>
> Let's assume that My_var and My_signal are new identifiers, my problem
> is that in the second example the command "Mysignal = 4." is recognized
> by Bison as an integer variable assignment (with parsing error because
> of "My_other_signal") while what should have been done is to recognize
> that "4. + My_other_signal" is a signal (and process it) and then do a
> signal assignment. In the third example, it works fine.
You must have sent us the wrong grammar. IDENTIFIER can only appear
before an '=', so the third example (where I assume My_other_signal is an
IDENTIFIER) should be a syntax error as well.