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 UAA11153; Tue, 3 Dec 2002 20:16:47 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA11141 for caml-list@pauillac.inria.fr; Tue, 3 Dec 2002 20:16:45 +0100 (MET) 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 LAA28374 for ; Tue, 3 Dec 2002 11:55:35 +0100 (MET) Received: from order.if.uj.edu.pl (order.if.uj.edu.pl [149.156.90.15]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gB3AtZX21141 for ; Tue, 3 Dec 2002 11:55:35 +0100 (MET) Received: (from ostruszk@localhost) by order.if.uj.edu.pl (8.11.6/8.11.6) id gB3AmqJ22827 for caml-list@inria.fr; Tue, 3 Dec 2002 11:48:52 +0100 Date: Tue, 3 Dec 2002 11:48:52 +0100 From: "Andrzej M. Ostruszka" To: Caml List Subject: [Caml-list] Re: yacc & lex: Does the contructor name matter? Message-ID: <20021203114852.A22797@order.if.uj.edu.pl> Mail-Followup-To: Caml List References: <20021202095557.A20380@order.if.uj.edu.pl> <20021203110153.B7512@pauillac.inria.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20021203110153.B7512@pauillac.inria.fr>; from xavier.leroy@inria.fr on Tue, Dec 03, 2002 at 11:01:53AM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Tue, Dec 03 (2002), Xavier Leroy wrote: [...] First of all thank you for an explanation > The actual grammar that ocamlyacc compiles down to a PDA has some > additional productions: > > $accept: %entry EOF { should not reduce } > %entry: '\001' line { stop parsing with result $2 } > line: expr { Some $1 } > | /*nothing*/ { None } I've looked at the .ml and .mli but haven't found anything regarding EOF so that's why I asked. > The best way to avoid this difficulty is to make sure that all your > grammar entry points are explicitly terminated by a token, as shown > in the example in section 12.6 of the manual: > > %start line > > %% > line: > | expr EoL { Some $1 } > | /* nothing */ EoL { None } :), I've read that section and knew the solution and just wanted to know the cause of this behaviour. > > - compile AST to list of functions which will take in arguments the > > operands and the "pointer" of the place where to store the result. > > I don't have now a clear idea how to do it (I still think in C :)) but > > the motivation is to remove pushing functions and stack management of > > the previous solution > > I don't understand your third option. Well I thought about having some list of records { double x, y; double* r; and maybe function pointer } where the function would take x and y and store the result where r points to and the job of the compiler would be to craft those pointers (and x's in case of constants) appropriately. As I've told I'm still rather C than OCaml guy :). Best regards PS. Doubling of the posts is not my fault it happens "somewhere" in France (one can check that by message ID). Maybe this is because I'm sending from another address that I'm subscribed? -- ____ _ ___ / | \_/ |/ _ \ Andrzej Marek Ostruszka / _ | | (_) | Instytut Fizyki, Uniwersytet Jagiellonski (Cracow) /_/ L|_|V|_|\___/ (PGP <-- finger ostruszk@order.if.uj.edu.pl) ------------------- 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