From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id TAA32092 for caml-redistribution; Wed, 27 Jan 1999 19:27:28 +0100 (MET) 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 UAA18559 for ; Tue, 26 Jan 1999 20:20:02 +0100 (MET) Received: from valery.alve.com (valery.alve.com [38.226.219.15]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id UAA27891 for ; Tue, 26 Jan 1999 20:20:00 +0100 (MET) From: mattwb@valery.alve.com Received: (from mattwb@localhost) by valery.alve.com (8.8.7/8.8.7) id NAA00701; Tue, 26 Jan 1999 13:17:54 -0600 Date: Tue, 26 Jan 1999 13:17:54 -0600 Message-Id: <199901261917.NAA00701@valery.alve.com> To: dmcclain@azstarnet.com CC: caml-list@inria.fr In-reply-to: <000c01be4952$09752290$210148bf@dylan> (dmcclain@azstarnet.com) Subject: Re: GenLex stream parsers too eager? References: <000c01be4952$09752290$210148bf@dylan> Sender: weis > >From: "David McClain" > >It appears that the Genlex derived parsers always eagerly tokenize = >negaitve integer and float constants. This causes incorrect behavior in = >closely spaced code (no-spaces): > > a-2*c --> parses as "a", "-2" ,"*", "c" instead of = >"a","-","2","*","c" > >So instead of getting one expression tree, I get two, with the first = >containing only "a". >Also, if the operator were exponentiation instead of multiplication, the = >second tree would incorrectly compute a (possibly) complex valued = >expression instead of a simple negative of a real expression. > >I have tried various workarounds, but they really obfuscate the original = >recursive descent structure of parsers. > >Any suggestions? (Perhaps I should be using OCAMLLEX and OCAMLYACC = >instead?) > I'd certainly suggest not using Genlex except for only the most trivial things. Ocamllex and ocamlyacc are not difficult and they're much more powerful. >David McClain >Sr. Scientist >Raytheon Missile Systems Co. >Tucson, AZ >http://www.azstarnet.com/~dmcclain/homepage.htm >