Writing an Eiffel compiler as a course project? 
Author Message
 Writing an Eiffel compiler as a course project?

        I have been teaching the compiler construction course (a two-
quarter/20 week course) here at UCSD for the past few years.  In the
past our target language has been Turing, a Pascal-like language.
It has served us well, but I would like to change.  I have heard good
things about Eiffel -- I am an established C++ programmer and am
interested in how Eiffel implements object-oriented paradigms.  The
students in my class are juniors and seniors, with a few courses in
C/C++ under their belts -- the goal is to get a compiler that
outputs assembly language for a reasonable set of Eiffel instructions
in that 20-week period.

        First of all, would Eiffel seem to be a good choice for a target
language?  Note that by no means are we required to implement a
compiler for the full language -- we can and will pare it down as
necessary.

        Secondly (assuming the consensus to the above is yes), where might
I find a specification for the language?  Specifically, a grammar
and some sort of documentation describing the semantics of the language
is what I'm looking for.  

        Any help/pointers/advice would be greatly appreciated!

        Brian

--
Brian Russ
CSE Department, UC San Diego



Tue, 27 Jan 1998 03:00:00 GMT  
 Writing an Eiffel compiler as a course project?

| The students in my class are juniors and seniors, with a few courses
| in C/C++ under their belts -- the goal is to get a compiler that
| outputs assembly language for a reasonable set of Eiffel instructions
| in that 20-week period.
|       First of all, would Eiffel seem to be a good choice for a target
| language?

With the caveat that I am not now an educator by profession, my
experience is that Eiffel would be a good target language.

However my practical experience at instructing C/C++ programmers how
to "think" so they can better understand Eiffel, not as a procedural
language but as an oo language, is that it takes them longer than the
average person who simply knows their way around a Windows screen.  

What I mean by "think" is the ability to abstract.  When I give some
very simple requirements for my accounting arithmetic class library to
those with C/C++ experience, they seem to have a mental barrier to
picking out objects, operands (features), and attributes from the
text.  When I say that usually nouns are objects, verbs are features,
and adjectives are qualifiers, they get half-way through the text then
start bit-twiddling in their minds' eye to figure out how to implement
the finished product.  It is not that they are stupid or do not follow
insturctions, but rather it is that their training makes them have a
shorter attention span to abstract thinking.  Meanwhile the non-C
types have circled all the nouns etc and are busy making
generalizations and abstract blobs of objects.  

What I am sldo saying is that C inculcates some very bad abstract
thinking habits which are not easily changed.  

I would suggest at least one-third of the course should be devoted to
abstracting problem domains before an attempt at designing a solution
is made.  I predict that the design (and implementation) phase would
then be fairly rapid with good results, provided that the compiler was
built from assembler primitives using itself at each iteration.  In
other words, the exercise is more meaningful if the compiler is
developed using itself, which is probably your intention anyway.

~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~

CEC Services, 2080 Kipling St, Lakewood, CO  80215-1502   USA
Voice: 303.231.9437; Facs: .231.9438; ISDN: .462.1107 & .1448
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~



Tue, 27 Jan 1998 03:00:00 GMT  
 Writing an Eiffel compiler as a course project?

Quote:
>    First of all, would Eiffel seem to be a good choice for a target
> language?  Note that by no means are we required to implement a
> compiler for the full language -- we can and will pare it down as
> necessary.
>    Secondly (assuming the consensus to the above is yes), where might
> I find a specification for the language?  Specifically, a grammar
> and some sort of documentation describing the semantics of the language
> is what I'm looking for.  
>    Any help/pointers/advice would be greatly appreciated!
>    Brian

Given that no Eiffel compiler on the market produces Assembler code,
you would be boldly going where ..., and depending on the machine
architecture that may be asking too much in a 20-week course.

My first recommendation would be that the compiler be written in
Eiffel, as there is no better way to gain exposure to the issues.

A couple of products from Monash University could also greatly
speed up the process, but there existence may skip over areas
you wish your students to learn for themselves. Specifically,
YOOCC (Yes! An OO Compiler Compiler) and TROOPER (Truly Reusable OO
Parser for Eiffel Reengineering) provide the tools for getting
up to and past the syntax stage and incorporating semantics into
a parser.

As to a specification, I don't think that any consolidated spec
exists yet that matches any existing implementation, and the
semantics are unclear on some key areas.
Nevertheless I think that would be a good starting point for
a compiler, as feedback from your class would be helpful in
stabilizing, and completing, the specifications.

Again Monash University may be your best starting point.

Depending on the exact areas of compiler development you want
your class exposed to, I think there is good potential for
developing an Eiffel compiler in Eiffel in 20 weeks, even
generating assembler code for a RISCish processor, but you
would definitely be pushing the envelope so keep in mind
some sort of contingency in case things go badly.


and just request information on obtaining the tools.

Good luck, and please keep us posted on developments.



Wed, 28 Jan 1998 03:00:00 GMT  
 Writing an Eiffel compiler as a course project?

Quote:

>        I have been teaching the compiler construction course (a two-
>quarter/20 week course) here at UCSD for the past few years.  In the
>past our target language has been Turing, a Pascal-like language.
>It has served us well, but I would like to change.  I have heard good
>things about Eiffel -- I am an established C++ programmer and am
>interested in how Eiffel implements object-oriented paradigms.  The
>students in my class are juniors and seniors, with a few courses in
>C/C++ under their belts -- the goal is to get a compiler that
>outputs assembly language for a reasonable set of Eiffel instructions
>in that 20-week period.

--------------
I imagine Eiffel is all or nothing. I'm a beginner with Eiffel myself, and
don't think there is a useful subset that can be isolated. Perhaps others
might comment on this.

The other side of this is that Eiffel doesn't appear to target assembly
code as its output. ISE melts its output to byte-codes, and employs a
runtime interpreter to support its operation. This is almost a necessity
for handling garbage collection and the like. ISE also "freezes" its code
by producing C code. I don't know how it handles garbage collection there,
but I imagine a daemon still walks around managing your memory for you.

Quote:

>        First of all, would Eiffel seem to be a good choice for a target
>language?  Note that by no means are we required to implement a
>compiler for the full language -- we can and will pare it down as
>necessary.

---------
I'm inclined to think Smalltalk might be a more realistic target. I'm far
from being an expert in that language, as well, but I'm struck by the
simplicity of its mechanisms. It appears to be an exercise in doing as
much as you can with as small a runtime engine as possible.

Another language to consider might be Java. Again, I know little about it,
except that it's syntax is somewhat like C++, and, like Eiffel and
Smalltalk, a run-time interpreted language.

There is some appeal to targetting byte-codes instead of assemby language.
First is portability, and second is the simplified abstraction. It might
also be possible to separate the runtime interpreter from the compiler.
Perhaps this would make a suitable focus for upper-classmen, enhancing the
interpreter from year to year.

In either case, I would prefer a language such as Java over Eiffel or
Smalltalk, simply because it explores a much broader spectrum of features
-- threads, etc. -- than its contemporaries. Just my two cents on that
matter.

Quote:

>        Secondly (assuming the consensus to the above is yes), where
might
>I find a specification for the language?  Specifically, a grammar
>and some sort of documentation describing the semantics of the language
>is what I'm looking for.  

---------
"Eiffel: the Language" by Bertrand Meyer appears to be the standard text.
Dr. Meyer is one of the designers of the language.

Mike.



Wed, 28 Jan 1998 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. The J-Eiffel project (Eiffel-to-Java compiler)

2. Writing an Eiffel compiler

3. Interesting Project (And an Excellent Project for Promoting Eiffel)

4. Project Bruce: Translating from Eiffel to Java (@Eiffel Liberty Journal)

5. Writing test cases in Eiffel; XP for Eiffel

6. Eon/Eiffel - Shareware Eiffel compiler

7. course project suggestions wanted

8. Hands-on Eiffel Techniques Course (USA) in July '96

9. Hands-On Eiffel Techniques Course in Europe - May 1996

10. Hands-on Eiffel Techniques Course, July 22-26, 1996

11. Advanced Eiffel Techniques course, July 24-28 1995

12. Courses Using Eiffel

 

 
Powered by phpBB® Forum Software