[Top][All Lists]

[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: Sun, 3 Dec 2006 11:30:54 +0100

On 2 Dec 2006, at 06:23, Paul Eggert wrote:

2. The prologue alternatives: %code, %requires, %provides, and % code-top.

Yes.  Though to be honest I can't even remember what all of them are

I have looked this up in the Bison manual CVS version. The idea I had a couple of years ago, in order to avoid such a cluster of options nobody can recall, was to have just one command with the syntax:
  %code <identifier> {<code>}
With this method, people developing skeleton files need not asking for a Bison grammar tweak. As I pointed out before, it is probably better to use %define for writing verbatim macros, and %code for code that adjusts according to output language.

Then the variations %requires, %provides, and %code-top might get uses such as
  %code header {<code>}      - For C++ (replacing %requires)
  %code import {<code>}      - For Java (replacing %requires)
  %code source-top {<code>}  - Replacing %code-top
or whatever: one can use the old names "requires", "provides", "code- top", too; whatever one finds is intuitive and descriptive.

It is still possible to extend the current %code by just letting it having an optional argument.

  Hans Aberg

reply via email to

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