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 RAA24354; Sat, 25 May 2002 17:17:37 +0200 (MET DST) Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id RAA24226 for caml-list@pauillac.inria.fr; Sat, 25 May 2002 17:17:37 +0200 (MET DST) 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 CAA15645 for ; Sat, 25 May 2002 02:41:57 +0200 (MET DST) Received: from cs.bu.edu (cs.bu.edu [128.197.12.2]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g4P0ftf22017 for ; Sat, 25 May 2002 02:41:56 +0200 (MET DST) Received: from csa.bu.edu (zhudp@csa [128.197.12.3]) by cs.bu.edu (8.12.2/8.12.2) with ESMTP id g4P0ftF2029981 for ; Fri, 24 May 2002 20:41:55 -0400 (EDT) Received: from localhost (zhudp@localhost) by csa.bu.edu (8.10.1/8.10.1) with ESMTP id g4P0fpw04025 for ; Fri, 24 May 2002 20:41:51 -0400 (EDT) X-Authentication-Warning: csa.bu.edu: zhudp owned process doing -bs Date: Fri, 24 May 2002 20:41:51 -0400 (EDT) From: dengping zhu X-Sender: zhudp@csa.bu.edu To: caml-list@inria.fr Subject: [Caml-list] help me with infix in ocaml Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hi, all, please help me if you can! Now I am converting a bunch of code from sml to ocaml. I met a problem with infix in ocaml. According to the example from camlp4, I got the following code: let gram = Grammar.create (Plexer.make());; let expr = Grammar.Entry.create gram "expr";; EXTEND expr: [ "1" LEFTA [] | "2" LEFTA []]; END;; let add_infix lev op = EXTEND GLOBAL: expr; expr: LEVEL $lev$ [ [ x = expr; $op$; y = expr -> <:expr< $lid:op$ $x$ $y$ >> ] ] ; END;; --------------- After I compile the code in ocaml by # #use "foo.ml";; I can add an infix, for example # add_infix "1" "op1";; But till now, how can I use this infix "op1"? Actually, I have the following code in sml, I can not figure out how to write it in ocaml. ... infix 2 -- ... fun (p -- q) (pos, ts) = let val (x, posx, pos, ts) = p (pos, ts) val (y, posy, pos, ts) = q x (pos, ts) in (y, Pos.union (posx, posy), pos, ts) end Thanks a lot! Dengping ------------------- 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