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 RAA00466; Tue, 2 Sep 2003 17:21:17 +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 RAA26322 for ; Tue, 2 Sep 2003 17:21:15 +0200 (MET DST) Received: from ep09.kernel.pl (ep09.kernel.pl [212.87.11.162]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h82FLET27901 for ; Tue, 2 Sep 2003 17:21:14 +0200 (MET DST) Received: (qmail 25120 invoked by uid 566); 2 Sep 2003 15:21:10 -0000 Date: Tue, 2 Sep 2003 17:19:22 +0200 From: Michal Moskal To: katre Cc: caml-list@inria.fr Subject: Re: [Caml-list] Calling ocamlyacc from ocamlyacc Message-ID: <20030902151922.GB4055@roke.freak> Mail-Followup-To: katre , caml-list@inria.fr References: <20030901172828.GA24208@henchmonkey.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030901172828.GA24208@henchmonkey.org> User-Agent: Mutt/1.4.1i X-PGP-Fingerprint: CF89 1B14 11BE 1CC9 2CA3 7497 5E32 69B4 BC71 B4C2 X-AntiVirus: scanned for viruses by AMaViS 0.2.1 (http://amavis.org/) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; michal:01 moskal:01 malekith:01 pld-linux:01 caml-list:01 0400,:01 expressing:01 michal:01 moskal:01 malekith:01 compiler:01 compiler:01 kernel:01 ocaml:01 sep:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Sep 01, 2003 at 01:28:28PM -0400, katre wrote: > Hello, > > I am currently involved in a project to re-build a compiler for an old > system from the mid-1980's, where we have the original compiler docs, we > have the original source files in the language used, but the actual > compiler itself is lost. This is an interesting pursuit, and I am > making use of it to learn ocaml. > > However, due to the nature of this language, which is not very regular > at all, I am having trouble expressing a parser in ocamlyacc that isn't > a large hack. What would be ideal would be to have one main parser, and > then one sub-parser that I could call only for a specified domain. > However, all the source code is in one place. > > Is there a way to specify a separate parser and lexer (using ocamllex > and ocamlyacc), and then to jump into them from an ocamlyacc action? You can define several start symbols in your grammar. Parsing functions are defined for each. You can also define several rule ... in your lexer (lexing functions are defined for each). Hope that helps, I can't help more, since I don't quite understand nature of your problem. -- : Michal Moskal :: http://www.kernel.pl/~malekith : GCS {C,UL}++++$ a? !tv : When in doubt, use brute force. -- Ken Thompson : {E-,w}-- {b++,e}>+++ h ------------------- 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