Related articles |
---|
Contemplating writing first compiler... comments please. mch24@harvey27.demon.co.uk (1997-06-30) |
Re: Contemplating writing first compiler... comments please. gelleric@kafka.informatik.uni-stuttgart.de (1997-07-04) |
Re: Contemplating writing first compiler... comments please. cdw10@cix.compulink.co.uk (1997-07-08) |
Re: Contemplating writing first compiler... comments please. mrm1@msm.cam.ac.uk (1997-07-21) |
Re: Contemplating writing first compiler... comments please. HSauro@fssc.demon.co.uk (Herbert M Sauro) (1997-07-22) |
Re: Contemplating writing first compiler... comments please. pardo@cs.washington.edu (1997-07-29) |
Re: Contemplating writing first compiler... comments please. anton@mips.complang.tuwien.ac.at (1997-08-09) |
From: | mch24@harvey27.demon.co.uk (Martin Harvey) |
Newsgroups: | comp.compilers |
Date: | 30 Jun 1997 22:45:12 -0400 |
Organization: | Compilers Central |
Keywords: | question |
Hi folks,
I'm a Computer Science Undergrad at Cambridge University in the UK,
and I've recently been looking for a fairly long-term spare time
project to keep me amused. Having just written a raytracer, I recently
decided to write a parser for it's input language using TP Lex & Yacc.
This led me on to think about writing a compiler. However, I've never
done anything of this sort before so I thought I'd ask for some
advice:
1. Plans
2. What I know
3. What I don't know
4. Questions
1. Plans.
I looked through various languages that I might write a compiler for,
and have decided that Modula-3 would be a good choice. I'm fairly
familiar with it, having used DEC M-3 version 3.5 It's a fairly simple
Wirth-Like language, and although it has some fairly advanced features
(garbage collection, object orientation, exception handling etc), I
feel that I could probably write a reasonable compiler for at least a
subset of the language, since it is (at least in concept) fairly
simple, and free of the many oddities and ambiguities which languages
such as C++ have. Admittely it's strongly typed so not as simple as
(for example) a BCPL compiler.
2. What I know.
a) I've had a lecture course on compilers, and read various parts of
"The Dragon Book" by Hopcroft, Aho, Sethi & Ullman. I'm fairly
familiar with Lex & Yacc, and the structure of SLR parsers (although I
don't know the details of LALR).
b) I know enough 8086 assembly language to get by on... eg simple
sorting algorithms, trees etc etc, and I'm up to scratch on DOS calls.
3. What I don't know... and would like to know.
I don't know much about assembly on a large scale, ie DOS segmentation
rules and conventions.
I've looked a little at target code generation using Tree rewriting
and dynamic programming, but I know very little about generation of
intermediate code and register allocation strategies.
It seems to me that the 8086 isn't exactly an "orthogonal" instruction
set, and the number of little caveats and restrictions could make
writing a code generator for it very hard. I'm not sure what
approaches have been taken to this.
4. Questions.
a) What important issues and text should I look at to give me a good
overall feel for writing a simple compiler.... I don't want to write
anything fancy or optimising... I'll be perfectly happy if several
(months / years / decades) from now I end up with something that self
builds and produces correct code.... even if it runs slowly.
b) I intend to write the compiler in Delphi (an object oriented
pascal) before bootstrapping it, and I think it would be useful to
write the compiler in an object oriented manner.. what useful info is
there on this?
3. Are there any other words of advice / encouragement / dissuasion
that you could give me??
many thanks.
Martin Harvey.
***********************************************
Martin Harvey
Uni email: mch24@cam.ac.uk
Home email: mch24@harvey27.demon.co.uk
Uni web pages: http://www-stu.pem.cam.ac.uk/~mch24/
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.