Browse thread
OCaml expression evaluated in a OCaml program
[
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: | -- (:) |
| From: | Jon Harrop <jon@j...> |
| Subject: | Re: [Caml-list] OCaml expression evaluated in a OCaml program |
On Monday 07 February 2005 16:13, Nicolas Dufour wrote: > sejourne_kevin wrote: > > Nicolas Dufour a écrit : > >> I try to know if I can evaluate OCaml expressions in a OCaml program > >> during runtime ?? > > > > This is not possible. But you can try something with the toplevel: > > http://caml.inria.fr/archives/200404/msg00282.html > > damned .. not possible ..... > I hope it exists scriptic languages embedded in ocaml ... or i will have > to create one ... oh boy .... I've done exactly this though, by spitting out an ocaml program, compiling it with ocamlopt (linked against the running program) and invoking it using marshalling to shuffle data back and forth. This is quite easy to implement and is the simplest way to write a JIT compiler in ocaml. If you don't really want to execute ocaml code but, rather, simple expressions then you can write your own interpreter quite easily. Many tutorials cover this. If you want to provide access to a few calls in your interpreter then you can simply implement them in your own little language. There are many tutorials on ocaml which describe simple interpreters. -- Dr Jon D Harrop, Flying Frog Consultancy Ltd.