Eiffel grammar

ralw <ralw@gec-mrc.co.uk>
Thu, 16 Feb 1995 15:31:38 GMT

          From comp.compilers

Related articles
Eiffel grammar ralw@gec-mrc.co.uk (ralw) (1995-02-16)
Re: Eiffel grammar assmann@ipd.info.uni-karlsruhe.de (1995-02-20)
| List of all articles for this month |

Newsgroups: comp.compilers
From: ralw <ralw@gec-mrc.co.uk>
Keywords: parse, Eiffel, question
Organization: Compilers Central
Date: Thu, 16 Feb 1995 15:31:38 GMT

I'm trying to write a portable windows graphics library for SIG Eiffel
(well, X11 and WIN32 at least). Naturally, to do this I need to introduce
a fairly large number of C routines, and also a number of shared flags.

For instance, I'd rather be able to write:




and this situation is repeated many times over. Now, I already have a
very simple tool that parses elementary Eiffel classes such as:

    class CONSTANTS


        SOLID, DOTTED, DASHED : INTEGER is unique;
        TOP_LEVEL_WIN, CHILD_WIN : INTEGER is unique;


into a C header file:

    #define SOLID 1
    #define DOTTED 2

    ... etc.

Of course, there is an implementation dependency here, in that I'm
assuming that 'unique' INTEGERs start at 1 and are sequential, but
it works for SIG Eiffel/S 1.3 and that's all I need for now.

The reason for posting this message here is that I'd like to take
my simple tool one stage further to where it can also generate
ANSI C prototypes from a complete Eiffel class, preferably without
needing to constrain the language used in the class.

I've tried to use bison but no matter how much I shift things around,
I get reduce-reduce conflicts which seem to be related to identifiers
used in pre- and post-conditions:

    assertion ::= [ label ':' ] expression
    label ::= identifier

The possible presence of a labelled assertion seems to make the grammar

So, two questions:

1. I've got a copy of the Eiffel Parser that was placed into the public
domain some years ago, written using the cocktail suite of tools. I can't
find the source for the grammar though. All I've got is the generated
C code. Does anyone know where I can find the source to that parser?

2. Does anyone know of an Eiffel grammar that doesn't have reduce-reduce
conflicts with bison/yacc?


Bill Williams

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.