bison-patches
[Top][All Lists]
Advanced

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

Re: proposal: simplify prologue alternatives into %code


From: Paolo Bonzini
Subject: Re: proposal: simplify prologue alternatives into %code
Date: Thu, 04 Jan 2007 17:26:53 +0100
User-agent: Thunderbird 1.5.0.9 (Macintosh/20061207)


If we're going to give the default a name, why have a default at all? Imagine reading a grammar file containing the following two directives:

  %code { CODE }

  %code "methods" { CODE }

They look different, so my intuition says they should do something different, but you're proposing that they do the same thing.

Why do you want to do this?

I'm ok with no default at all; I figured that *you* had a reason to have a default :-) and that anyway you need to give a name to the block (if only for consistency and simplicity).

One reason would be that (I'm making up this example in Java, where the absence of %union makes everything simpler)

%{
%}
...
%code {
}

could be an alternative way to say

%code "imports" {
}
...
%code "methods" {
}

not requiring one to remember the "magic" (and possibly easy to misspell?) keywords.

Paolo




reply via email to

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