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 AAA11595; Thu, 17 Jun 2004 00:48:06 +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 AAA14420 for ; Thu, 17 Jun 2004 00:48:05 +0200 (MET DST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i5GMm2EV017522; Thu, 17 Jun 2004 00:48:02 +0200 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id AAA11976; Thu, 17 Jun 2004 00:48:01 +0200 (MET DST) From: Pierre Weis Message-Id: <200406162248.AAA11976@pauillac.inria.fr> Subject: Re: [Caml-list] ocamllex/yacc and camlp4 In-Reply-To: <20040616085616.B26623@beaune.inria.fr> from Luc Maranget at "Jun 16, 104 08:56:16 am" To: Luc.Maranget@inria.fr (Luc Maranget) Date: Thu, 17 Jun 2004 00:48:01 +0200 (MET DST) Cc: jgoerzen@complete.org, caml-list@inria.fr X-Mailer: ELM [version 2.4ME+ PL28 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 40D0CE22.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; pierre:01 weis:01 pierre:01 weis:01 caml-list:01 camlp:01 implemented:01 camlp:01 bootstrap:01 ocamlc:01 bootstrap:01 ocamlc:01 damned:01 examples'':01 cristal:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, > > Quick question: why are ocamllex and ocamlyacc not implemented with > > camlp4? They seem to be doing exactly what camlp4 is there for, and I > > think would serve as great camlp4 examples (plus being able to extend > > *their* syntax could be very powerful indeed.) > > > > Thanks, > > John > > Hello, > > First there is history, ocamllex and ocamlyacc predate camlp4, thus > they were not written with camlp4 initially. > > Second there is bootstrap. Since the lexer and parser of ocamlc itself > are written with ocamllex/ocamlyacc, Making these tools to depend on > camlp4 would include camlp4 in the bootstrap cycle of ocamlc. > The resulting situation would complicate bootstraping ocamlc. > > Of course there could be camlp4 versions of ocamllex/ocamlyacc in > addition to ocamllex/ocamlyacc versions of ocamllex/ocamlyacc. Well, > nobody ever thought about doing that, I guess. > > -- Luc Maranget I would add two points to Luc's answer: 1) ocamllex and ocamlyacc implementation technologies are damned fast and it is difficult to compete with them using streams. 2) Semantics differences between Yacc and functionnal parsing are large and complex, so that implementing the precise Yacc semantics with its reduce/reduce and shift/reduce conflicts and the default conflicts resolution that Yacc also implements could not be a trivial task. Last but not least, the actual ocamllex/ocamlyacc implementations work pretty well, so that there is no clear necessity to rewrite them. In conclusion: pure Camlp4 implementation of ocamllex/ocamlyacc is still an interesting and challenging progamming task for the next few years, if you (or someone else) had the will and time to provide two ``great camlp4 examples'' to the rest of us... Happy hacking :) Pierre Weis INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis/ ------------------- 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