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 SAA13112 for caml-redistribution; Tue, 28 Jul 1998 18:41:38 +0200 (MET DST) 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 EAA11485 for ; Tue, 28 Jul 1998 04:18:44 +0200 (MET DST) Received: from kurims.kurims.kyoto-u.ac.jp (kurims.kurims.kyoto-u.ac.jp [130.54.16.1]) by concorde.inria.fr (8.8.7/8.8.7) with ESMTP id EAA11903 for ; Tue, 28 Jul 1998 04:18:41 +0200 (MET DST) Received: from localhost (safran.kurims.kyoto-u.ac.jp [130.54.16.91]) by kurims.kurims.kyoto-u.ac.jp (8.9.0/3.6W) with ESMTP id LAA25385; Tue, 28 Jul 1998 11:17:20 +0900 (JST) To: oliver@fritz.traverse.com, caml-list@pauillac.inria.fr Subject: Re: OLabl bug? In-Reply-To: Your message of "Mon, 27 Jul 1998 15:06:50 -0400 (EDT)" References: X-Mailer: Mew version 1.92 on Emacs 20.2 / Mule 3.0 (MOMIJINOGA) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-Id: <19980728111617B.garrigue@kurims.kyoto-u.ac.jp> Date: Tue, 28 Jul 1998 11:16:17 +0900 From: Jacques GARRIGUE X-Dispatcher: imput version 971024 Sender: weis > I had originally sent this to the CAML mailing list, but I think, in > restrospect, this should have been sent to you. > > While goofing around with bignums, I entered the following program > for computing a crude bound on the van der Waerden number for length > 3 and partition 3. > > open Num > open Nat > open Big_int > open Ratio > > let rec n k l = > let rec m i = > if i =/ Int 0 then > Int 1 else > Int 2 > */ (m (pred_num i)) > */ (n (k **/ (m (pred_num i))) (pred_num l)) in > if l =/ Int 2 then succ_num k else m k > in > print_string (string_of_num (n (Int 3) (Int 3)));; > > Pierre Weis tells me this is legal OCAML, but OLABL complains about > a syntax error at the second in. What can you tell me? He is slightly wrong: your program as such will raise a syntax error in ocaml also. He took me some time to find it, because I was always pasting your input in two times: first the open statements, and then the let in, and if you do that there is no error. This is not an olabl bug, neither really an ocaml one. The problem is that you are mixing two syntaxes: the one with terminator (;;), and the one without (nothing after open). Normally the first syntax is to be used at toplevel, and the second in files, but there are hacks in the parser to allow a certain level of mixing, which is confusing, I must admit. Seeing a let immediatly after an open declaration, the parser is waiting for a definitional let, and not a let in. So it throws you when the pairing "in" comes. Two solutions: either you add a terminator between the open sequence and the let, or you add a dummy toplevel let: let _ = let ... in ... (The second one is the only possibility when writing compiled modules) Cheers, Jacques