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 QAA09368; Fri, 24 Jan 2003 16:23:17 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA23906 for ; Fri, 24 Jan 2003 16:23:16 +0100 (MET) Received: from lri.lri.fr (lri.lri.fr [129.175.15.1]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id h0OFNFr23134 for ; Fri, 24 Jan 2003 16:23:16 +0100 (MET) Received: from pc8-123 (mail@pc8-123 [129.175.8.123]) by lri.lri.fr (8.11.6/jtpda-5.3.2) with ESMTP id h0OFCBP15621 ; Fri, 24 Jan 2003 16:12:11 +0100 (MET) Received: from filliatr by pc8-123 with local (Exim 3.35 #1 (Debian)) id 18c5V4-0000Ed-00; Fri, 24 Jan 2003 16:12:10 +0100 From: Jean-Christophe Filliatre MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15921.22474.602526.543452@lri.lri.fr> Date: Fri, 24 Jan 2003 16:12:10 +0100 To: Daniel.Andor@physics.org CC: caml-list@inria.fr Subject: Re: [Caml-list] camlp4 vs. ocamllex/yacc? In-Reply-To: <200301241415.44042.da209@cam.ac.uk> References: <200301241415.44042.da209@cam.ac.uk> X-Mailer: VM 6.93 under Emacs 20.7.2 Reply-To: Jean-Christophe.Filliatre@lri.fr (Jean-Christophe Filliatre) X-MailScanner: Found to be clean Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > What are the advantages/disadvantages of using camlp4 vs. a combination of > ocamllex and ocamlyacc? For having used both of them intensively, I see (at least) the following advantages of camlp4: - it comes with a lexer, saving you the burden of writing one (this lexer conforms to ocaml lexical conventions; for prototype implementations, it is usually fine) - it offers high level grammar constructors such as LIST0, LIST1, OPT, ... It results in cleaner and more concise grammars. Another advantage of camlp4, not of common use, is to propose an ocaml datatype for grammars: thus grammars can be extended dynamically. This is not possible with ocamlyacc grammars. The (sole?) advantage of ocamlyacc is when you already have a YACC grammar. Turning it into an ocamlyacc grammar is almost immediate. > Is there already a translator like this out there (to save me the effort)? There are probably many (Ocaml is, in particular, a good tool to write compilers) but this really depends on your input syntax (there are really *many* ways to write mathematics using ASCII :-). -- Jean-Christophe ------------------- 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