From: Jon Harrop <jon@jdh30.plus.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] OCaml expression evaluated in a OCaml program
Date: Mon, 7 Feb 2005 16:47:29 +0000 [thread overview]
Message-ID: <200502071647.29407.jon@jdh30.plus.com> (raw)
In-Reply-To: <420793B9.3020504@neometsys.fr>
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.
next prev parent reply other threads:[~2005-02-07 16:55 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-07 13:42 Nicolas Dufour
2005-02-07 16:17 ` [Caml-list] " sejourne_kevin
2005-02-07 16:13 ` Nicolas Dufour
2005-02-07 16:47 ` Jon Harrop [this message]
2005-02-07 17:08 ` Yaron Minsky
2005-02-07 17:21 ` Vincenzo Ciancia
2005-02-07 20:31 ` [Caml-list] " Robert Roessler
2005-02-07 20:42 ` Brock
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200502071647.29407.jon@jdh30.plus.com \
--to=jon@jdh30.plus.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox