From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 12DB6BB9C for ; Thu, 22 Dec 2005 09:21:08 +0100 (CET) Received: from zproxy.gmail.com (zproxy.gmail.com [64.233.162.192]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jBM8L7fF012348 for ; Thu, 22 Dec 2005 09:21:07 +0100 Received: by zproxy.gmail.com with SMTP id z31so330664nzd for ; Thu, 22 Dec 2005 00:21:07 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=HlmpjxRMgxh7qeh9K3ks6SV/BeW+/90pJWXyfDyQYMu3J2vmLkx8D+2/dhV80htTiHCI5zQ55LgDetWxtXnSCx315WzWXW3WYAsc3En5A2hFHRwcaMPu1+r92/WF+LyNcSMHUwCD23nUceIxXEc4twRUjEieP3U9yGRo/ql5BFE= Received: by 10.64.204.11 with SMTP id b11mr95613qbg; Thu, 22 Dec 2005 00:21:06 -0800 (PST) Received: by 10.65.23.16 with HTTP; Thu, 22 Dec 2005 00:21:06 -0800 (PST) Message-ID: Date: Thu, 22 Dec 2005 21:21:06 +1300 From: Jonathan Roewen To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] toplevellib.cma broken? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: X-Miltered: at nez-perce with ID 43AA61F3.001 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 toplevellib:01 toplevellib:01 parsing:01 typecode:01 parsing:01 pervasives:01 toplevel:01 toploop:01 toplevel:01 lexing:01 toploop:01 printf:01 stdin:01 printf:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=RCVD_BY_IP autolearn=disabled version=3.0.3 > > Hi, > > > > I'm trying to use toplevellib in my kernel, and I'm having some -very- > > weird problems. > > > > Here's a sample session on my kernel: > > > > caml> 45;; > > - : int =3D 45 > > caml> print_int 4;; > > Error parsing/evaluating expression: Typecode.Error(_,_) > > caml> 45.67;; > > Error parsing/evaluating expression: Failure("float_of_string") > > caml> 45;; > > Error parsing/evaluating expression: Failure("float_of_string") Well, I found the Errors module for formatting exceptions. That seems to help a little bit. But I have one really weird problem: all the symbols in Pervasives aren't defined. Also: it seems to choke on strings, and invoking functions. For example: "Base_io.print_int 45;;" gets printed, but then it locks up. Also, entering "45.67;;" kills the toplevel interpreter. I have: try Toploop.initialize_toplevel_env(); let eval txt =3D let lb =3D (Lexing.from_string txt) in let phr =3D !Toploop.parse_toplevel_phrase lb in Toploop.execute_phrase true Format.std_formatter phr in while true do try Console.printf "caml> "; ignore (eval (IO.read_line stdin)) with e -> Errors.report_error Format.std_formatter e; done; with | Env.Error e -> Env.report_error2 e | e -> Printf.printf "Toploop died: %s\n" (Printexc.to_string e); Obviously, the exception escapes the first try/with. Perhaps the floating point is a problem with DST -- I'll have to double check on the floating point stuff. However, the rest is of great importance to me. It's loading pervasives fine, as far as I can tell. So why aren't the symbols defined??? Jonathan