help-bison
[Top][All Lists]
Advanced

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

Semantic values being stuffed up


From: David Mitchell
Subject: Semantic values being stuffed up
Date: Thu, 04 Jul 2002 15:44:56 +1200
User-agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.0rc2) Gecko/20020510

I am trying to allow a user to declare constants using something along the lines of:

FOO EQU 1

I have a rule:

const_decl: CONST EQU IMMED { add_constant($1, $3); }

My problem is that the value of $1 here is 'FOO EQU 1', and $3 is '1'. I have tried adapting this to:

const_decl: constant EQU IMMED { add_constant($1, $3); }

constant: CONST { $$ = $1; fprintf(stderr, "Constant = %s\n", $$); }

I get the output: 'Constant = FOO' but the function add_constant still gets 'FOO EQU 1' as its first parameter. This just doesn't make sense. I have declared CONST and constant as char*.

Any ideas?
Thanks in advance
Dave




reply via email to

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