[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-12-22 (08:21) |
From: | Jonathan Roewen <jonathan.roewen@g...> |
Subject: | Re: [Caml-list] toplevellib.cma broken? |
> > 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 = 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 = let lb = (Lexing.from_string txt) in let phr = !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