Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] example toy compiler in OCAML?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Xavier Leroy <Xavier.Leroy@i...>
Subject: Re: [Caml-list] example toy compiler in OCAML?
> Could anyone point me to code for an example toy/small compiler
> (i.e. small enough to understand easily, preferably with ocamlllex and
> ocamlyacc specifications instead of hardcoded lexing/parsing)
> implemented in OCAML?

Michel Mauny's tutorial "Functional programming using Caml Light"
(http://caml.inria.fr/tutorial/index.html) ends with a simple compiler
written in Caml Light.  An OCaml version of the code is included in
the collection of examples http://caml.inria.fr/Examples/oc.tar.gz.

Jason Hickey uses OCaml in his compiler design course at Caltech,
see http://www.cs.caltech.edu/cs134/cs134b/  (apparently, the course
notes have been temporarily withdrawn, but I hope they'll be back
later in the academic year :-).

If you read French, there's a toy assembler and Pascal compiler in the
book "Le langage Caml", by Pierre Weis and I.  Source code is (again)
available in the collection of examples
http://caml.inria.fr/Examples/oc.tar.gz.

More advanced compilation in OCaml (and in French) is described in
Didier Rémy's Polytechnique course notes, 
http://pauillac.inria.fr/~remy/poly/compil/

Enjoy,

- Xavier Leroy
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr