Browse thread
How can I generate an AST?
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2007-08-20 (08:22) |
From: | Loup Vaillant <loup.vaillant@g...> |
Subject: | Re: [Caml-list] How can I generate an AST? |
2007/8/19, Daniel de Rauglaudre <daniel.de_rauglaudre@inria.fr>: > Hi, > > On Sun, Aug 19, 2007 at 07:39:50PM +0200, Loup Vaillant wrote: > > > I would like to write a preprocessor of my own (to make a lisp > > syntax). In the process, I am slowly catching up with the Ocaml AST. > > If you just need a Lisp syntax, you can use Camlp5 which proposes a > Lisp syntax among its parsing kits: > http://pauillac.inria.fr/~ddr/camlp5/doc/html/scheme.html > > Perhaps (probably) incomplete, but you can complete or fix it if you > want. Looks great, but unfortunately, I think it is unsuitable for what I want to do : a macro system based on a lisp-like syntax. I want reader macros as well as regular ones. (By the way, have I overlooked a "defmacro" in your syntax?) > If you are interested on the fact of *programming* yourself a new > syntax, use Camlp5: make your parser generating Camlp5 AST and the > rest (dumping syntax tree) is already done by Camlp5. See the doc > or ask who knows for hints (me or other). This may be a better approach. However, I am not eager to use camlp*, for it will introduce a additional dependency. I may choose this however, if the camlp* AST is simpler than the Ocaml AST. Where can I find it? Thank you, Loup