Re: writing a compiler...

m.a.ellis@ucsnew1.ncl.ac.uk
5 Jun 2003 23:13:27 -0400

          From comp.compilers

Related articles
writing a compiler... ltk_RE_MO_VE_@libero.it (Tommy) (2003-06-03)
Re: writing a compiler... vrotaru@seznam.cz (Vasile Rotaru) (2003-06-05)
Re: writing a compiler... m.a.ellis@ucsnew1.ncl.ac.uk (2003-06-05)
Re: writing a compiler... JeffKenton@attbi.com (Jeff Kenton) (2003-06-05)
Re: writing a compiler... cfc@shell01.TheWorld.com (Chris F Clark) (2003-06-05)
Re: writing a compiler... Steve_Lipscombe@amat.com (2003-06-08)
Re: writing a compiler... vbdis@aol.com (2003-06-20)
Re: writing a compiler... Conor.ONeill.NoSpamPlease@logicacmg.com (Conor O'Neill) (2003-06-20)
Re: writing a compiler... lex@cc.gatech.edu (Lex Spoon) (2003-06-25)
| List of all articles for this month |

From: m.a.ellis@ucsnew1.ncl.ac.uk
Newsgroups: comp.compilers
Date: 5 Jun 2003 23:13:27 -0400
Organization: University of Newcastle upon Tyne
References: 03-06-016
Keywords: books, design
Posted-Date: 05 Jun 2003 23:13:27 EDT

Tommy wrote:
> some advice, some links, some trivial compilers to look at, some
> books, some exercises and so on...


> I am proficient in C and C++ so these are
> the languages I prefer to use to write code. However, I understand and
> I am able to "use" Pascal


I've been looking at a copy of "Writing Compilers and Interpreters: An
applied approach using C++ (2nd edition)" by Ronald Mak.


It walks through the implementation of a Pascal interpreter and x86
compiler in C++. Along the way, it includes small projects like a
pretty printer, and whatever.


It's a bit frustrating, I find it a bit slow, but I wish I had had it
when I was sixteen.


> I would like to write a Pascal compiler because Pascal is "formally
> defined"


Mmph. In a round about, fudge it a bit here, kind of way....


IIRC it's Pascal that allows something like:
if f(a) and g(b) then ...
to evaluate f() and g() in either order.


But if f() and g() have side-effects such that the behaviour of the
program is determined by which executes first, then the program is
wrong. I don't think that's something that can be checked by a
compiler on an arbitrary program?


Incidently, I've seen a formal semantics of Java, by David von Oheimb
(maybe with Nipkow as well?) Oh, hang on...
http://www4.in.tum.de/~oheimb/papers/ and seen LNCS Vol 1523: Formal
Syntax and Semantics of Java.


I haven't had a chance to read it yet, but there's a copy round here
somewhere....


Martin


Post a followup to this message

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