On 7 Mar 2006, at 04:02, Frans Englich wrote:

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.

Bison writes (I think) an array into the parser with those names. Check output parser source.

                        ***

Also,

Please keep one topic per post, with descriptive subject for each.

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?

Simply because nobody has implemented it. I think some grads at Berkeley made a Bison version with such constructs.

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.

One just expands it using standard rewrites (which I have posted here before). In Bison, one would also enable the addition of suitable actions.

  Hans Aberg




_______________________________________________
[email protected] http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to