Related articles |
---|
Project on Compiler alluri@utdallas.edu (1994-01-13) |
Re: Project on Compiler samiam@netcom.com (1994-01-13) |
Re: Project on Compiler jhall@garden.WPI.EDU (1994-01-13) |
Re: Project on Compiler wjw@eb.ele.tue.nl (1994-01-14) |
Re: Project on Compiler bischoff@cs.iastate.edu (Kurt Bischoff) (1994-01-14) |
Re: Project on Compiler djohnson@arnold.ucsd.edu (1994-01-16) |
Newsgroups: | comp.compilers |
From: | samiam@netcom.com (Scott Moore) |
Keywords: | courses |
Organization: | NETCOM On-line Communication Services (408 241-9760 guest) |
References: | 94-01-044 |
Date: | Thu, 13 Jan 1994 09:36:07 GMT |
alluri@utdallas.edu (Sridhar Alluri) writes:
>We have been given a semester long project in our compilers class. Our
>project is divided into 6 sub-projects. They are
>1. Lexical Analyzer
>2. Parser
>3. Symbol Table
>4. Expand array references, type conversions, constant fold and labelize
>5. Runtime Library
>6. Code Generation and Execution
>We are supposed to write a compiler for a subset of Pascal. I would like
>to know how complex the project is going to be. ...
I've done two Pascal compilers now. Alias, I missed the joy of
implementing a subset. Writing a full compiler from scratch to date of
passing test suites seems to be about 1 year minimum.
However, I think that the project could be cut down to size quite easily.
First (as is usual for college projects), you output only pseudocode for
interpretation. Skipping the "real world" coding aspects saves a lot of
time. Second, you will save a good deal by implementing only elementry or
no error recovery (ie., simply terminate on error). Of course, you'll miss
an important subject by not doing this, and it may not be admissable to
your teacher. However, implementing a minimum error recovery scheme (such
as simple symbol set skipping) will probally do what you need. As
mentioned, the fastest way to do the parser is with a tool and a
predefined grammar, but a parser for full pascal can be finished in 2
weeks to 1 month in normal C or Pascal code. People are going to yell at
me for being old fashioned, but I prefer "hardcoding" it to yacc. If you
are a beginner, yacc is one more thing to learn, but if you are an expert,
you get more control in straight code.
I suspect that you will find that your subset has been chosen to eliminate
most of the really nasty sections of the language, so your job will not be
as complex as it sounds.
Finally, there are several examples of exactly what you are trying to do
already in print. See for instance, the Pascal-s compiler [wirth] and
Brinch Hansen's stuff.
[sam]
--
Scott A. Moore [SAM]
samiam@netcom.com
San Jose, CA USA
408-383-9154
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.