help-bison
[Top][All Lists]
Advanced

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

Retrieving the string name of token


From: Frans Englich
Subject: Retrieving the string name of token
Date: Tue, 7 Mar 2006 03:02:52 +0000
User-agent: KMail/1.8.50

Let's say I've declared the following token:

%token IMPORT_MODULE                        "import module"

Is it somehow possible to in code retrieve "import module" when given the 
IMPORT_MODULE define/enum? Is there a public function somewhere for that? I 
want to keep the descriptions centralized.

                        ***

Also, sometimes I really feel like writing rules like this:

Rule: (A | B) C D

Which would allow A C D or B C D. What is the reason to that such constructs 
are not possible?

I think it would be possible if for example one ensured that A and B had the 
same types, or disallowed token values to be retrieved($N) if the types were 
incompatible.

Yes, I know the same can be expressed this way:

Rule: AorB C D

AorB: A
| B

I also guess that if Bison support the imaginary form above(if that's at all 
possible) it would rewrite into this latter, valid form.

My point being I find the first form much more readable.


Cheers,

                Frans




reply via email to

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