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 JAA14970; Sat, 14 Aug 2004 09:55:26 +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 JAA14449 for ; Sat, 14 Aug 2004 09:55:25 +0200 (MET DST) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i7E7tMmL014673 for ; Sat, 14 Aug 2004 09:55:23 +0200 Received: from [192.168.1.200] (ppp197-3.lns1.syd2.internode.on.net [203.122.197.3]) by smtp1.adl2.internode.on.net (8.12.9/8.12.9) with ESMTP id i7E7tI4Y008533; Sat, 14 Aug 2004 17:25:19 +0930 (CST) Subject: Re: [Caml-list] CFG's and OCaml From: skaller Reply-To: skaller@users.sourceforge.net To: Jon Harrop Cc: Ocaml Mailing List In-Reply-To: <200408140125.59473.jon@jdh30.plus.com> References: <200408140125.59473.jon@jdh30.plus.com> Content-Type: text/plain Message-Id: <1092470117.29139.582.camel@pelican.wigram> Mime-Version: 1.0 X-Mailer: Ximian Evolution 1.2.2 (1.2.2-4) Date: 14 Aug 2004 17:55:18 +1000 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 411DC56A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 sourceforge:01 2004:99 'designed':99 conforming:01 disallow:01 lalr:01 camlp:01 coercing:01 fiddle:01 9660:01 glebe:01 productive:01 anyhow:01 ocaml:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Sat, 2004-08-14 at 10:25, Jon Harrop wrote: > I have some (probably trivial) questions about parsers: > > 1. Are most programming languages designed to be implementable using lex and > yacc? No :) Felix is, and many academic languages are, but most industrial kind of languages aren't. Heck, can you really use the word 'designed' for them? > 2. If so, are their designs restricted by this? There are some constraints I wish didn't exist in the Felix grammar. Its not too bad -- I tend to accept if a simple parsing engine can parse it, so can a human, so conforming to the constraints is a good idea anyhow. > 3. If so, is the fact that most languages disallow "a 4. Could that be added to OCaml? ;-) Not without breaking existing code -- but Camlp4 could add the a < b &< c &< d syntax easily I expect. > 5. Is it productive to think in terms of coercing lex and yacc into doing as > much of the work as possible I personally think you should do the opposite -- let lex/yacc do the least possible work since they're fairly rigid. You may need to fiddle with your grammar to get the language you want -- and it is better if that has the minimum impact on your semantic logic. IMHO. > and then using postprocessing to do the rest > (e.g. this is the way I'd implement a