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 QAA24022; Sat, 20 Sep 2003 16:38:28 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 QAA18306 for ; Sat, 20 Sep 2003 16:38:26 +0200 (MET DST) Received: from rabelais.socialtools.net (rabelais.socialtools.net [81.2.94.243]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h8KEcQ522585 for ; Sat, 20 Sep 2003 16:38:26 +0200 (MET DST) Received: by rabelais.socialtools.net (Postfix, from userid 108) id 9A824232DF; Sat, 20 Sep 2003 15:38:25 +0100 (BST) Received: from socialtools.net (chaucer.socialtools.net [81.2.94.242]) by rabelais.socialtools.net (Postfix) with ESMTP id DA12C232DA for ; Sat, 20 Sep 2003 15:38:22 +0100 (BST) Message-ID: <3F6C665E.5030508@socialtools.net> Date: Sat, 20 Sep 2003 15:38:22 +0100 From: Benjamin Geer User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624 X-Accept-Language: en-gb, en, fr, it MIME-Version: 1.0 To: "caml-list@inria.fr" Subject: [Caml-list] parsing included files recursively using ocamllex and ocamlyacc X-Enigmail-Version: 0.76.5.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, hits=0.5 required=5.0 tests=RCVD_IN_OSIRUSOFT_COM,USER_AGENT_MOZILLA_UA,X_ACCEPT_LANG version=2.54 X-Spam-Checker-Version: SpamAssassin 2.54 (1.174.2.17-2003-05-11-exp) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; recursively:01 recursively:01 caml-list:01 filenames:01 run-time:01 caml:01 preprocessor:02 compile:02 stack:02 interpreter:03 recursive:03 recursive:03 library:03 lexbuf:03 brief:96 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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), posted here in 1997 by Xavier Leroy, which suggests one way to write a recursive "yacc_start" function. However, the details of this approach aren't clear to me; could someone provide a more detailed explanation of what would be involved (e.g. a brief outline of the contents of this function)? What about ocamllex? Would I have to save the lexbuf on a stack, and restore it after each recursive call? I considered using (or writing) a preprocessor to do the includes, but I couldn't think of a way to do this without losing the ability to report filenames and line numbers in run-time error messages. Ben ------------------- 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