From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA30332; Mon, 22 Sep 2003 09:23:10 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA24516 for ; Mon, 22 Sep 2003 09:23:08 +0200 (MET DST) Received: from ait780f.ait.physik.uni-tuebingen.de (ait780f.ait.physik.uni-tuebingen.de [134.2.76.59]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8M7N7519481 for ; Mon, 22 Sep 2003 09:23:07 +0200 (MET DST) Received: from localhost (goehler@localhost) by ait780f.ait.physik.uni-tuebingen.de (8.9.2/8.9.2) with ESMTP id JAA01111; Mon, 22 Sep 2003 09:22:39 +0200 (CEST) X-Authentication-Warning: ait780f.ait.physik.uni-tuebingen.de: goehler owned process doing -bs Date: Mon, 22 Sep 2003 09:22:39 +0200 (CEST) From: Eckart Goehler X-X-Sender: To: Benjamin Geer cc: Michal Moskal , "caml-list@inria.fr" Subject: Re: [Caml-list] parsing included files recursively using ocamllex and ocamlyacc In-Reply-To: <3F6CA583.6050801@socialtools.net> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 recursively:01 michal:01 moskal:01 recursively:01 caml-list:01 becuase:01 astronomy:01 caml:01 caml:01 rec:01 sep:01 sep:01 tar:01 parser:02 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 20 Sep 2003, Benjamin Geer wrote: > Michal Moskal wrote: > > On Sat, Sep 20, 2003 at 03:38:22PM +0100, Benjamin Geer wrote: > >>I'm writing an interpreter for a small language (to be released as an > >>open source library), using ocamllex and ocamlyacc. I'd like this > >>language to support an instruction that, at compile time, recursively > >>includes source code from another file. > >> > >>I searched the list archives and found a message > >>(http://pauillac.inria.fr/caml/caml-list/0258.html) [snip] > > > > Wouldn't it work to simply call parsing function from parser rule? > > Well, the message mentioned above gave me the impression that it > wouldn't be quite so easy, apparently becuase the generated parsing > function isn't defined with "let rec". [snip] The other point is the lex table generated with ocamlyacc comes inside the start function. > So I just wondered: has anyone > done this? As already mentioned in http://caml.inria.fr/archives/200309/msg00047.html I did that by modifying ocamlyacc. Works pretty well. I'll put the modified ocamlyacc at http://astro.uni-tuebingen.de/~goehler/ocamlyacc.tar.gz Maybe its possible to modify the official ocamlyacc supporting these features in future. ciao eckart ----------------------------------------------------- Eckart Goehler IAAT, Astronomy 72076 Tuebingen e-mail : goehler@astro.uni-tuebingen.de ----------------------------------------------------- ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners