bison-patches
[Top][All Lists]
Advanced

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

Re: experimental features in Bison 2.3a+


From: Hans Aberg
Subject: Re: experimental features in Bison 2.3a+
Date: Wed, 6 Dec 2006 13:47:19 +0100

[I get permenant error on Help-Bison. This list eseem to work]

On 6 Dec 2006, at 10:55, Joel E. Denny wrote:

For verbatim strings:

  %define "NAME" "STRING"

No, just one line. This why <code> had to be added.

Do you have a specific need for multiline strings that are not parsed as
code?

I have the need for code to be added, therefore the feature was added to %define. But, by the reason I gave, that is, output language parsing, I think it is better to have a separate command %code for adding code. This is a conclusion I came to rather recently, some weeks ago. Before that, I still felt it would be better to have %code for code, as it would look better, but I did not really care. So I did not complain when it appeared in %define. But if you are going to add a host %code like commands anyway, it seems better to have single one with an argument. It will free up the Bison language name space - fewer keywords needed.

As for other uses of %define, I have no such immediate needs. But I think such needs may turn up, at least for others. Then I think it is best to reserve it for verbatim macros. Macros that require special parsing should be given special command names - that is the principle I see.

For code that needs to be parsed:

  %define "NAME" { CODE }

How does calling it %code in the second case solve the problem of multiple
languages?

Because parsing of the code part needs to be changed according to language.
For a macro define, that seems to be a poor practice.

So the issue isn't with multiple languages?

Yes: right now, the languages that are parsed have similar parsing and the code additions are similar. But suppose the parsing becomes more different, plus that there is a need for adding verbatim code. Then %code should be used for regular code, and %define for the verbatim code.

It's with parsing CODE at all
when the directive is named %define?

This doesn't bother me.  { CODE } is always parsed no matter where it
appears in the Bison grammar file.

So, if %define is used to parsing code at all, I think it should not parse comments, strings and characters, etc..

And, I think removing the redundant quotes around NAME is pretty straightforward. There, I think Bison should admit '-" in macro names, as it will look good in grammar rules, and therefore elsewhere. - I do not know if M4 handles it.

  Hans Aberg






reply via email to

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