caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* OCaml expression evaluated in a OCaml program
@ 2005-02-07 13:42 Nicolas Dufour
  2005-02-07 16:17 ` [Caml-list] " sejourne_kevin
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolas Dufour @ 2005-02-07 13:42 UTC (permalink / raw)
  To: caml-list

Hello

I try to know if I can evaluate OCaml expressions in a OCaml program 
during runtime ??

Any ideas ?

Thank you

Nicolas Dufour


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OCaml expression evaluated in a OCaml program
  2005-02-07 16:17 ` [Caml-list] " sejourne_kevin
@ 2005-02-07 16:13   ` Nicolas Dufour
  2005-02-07 16:47     ` Jon Harrop
  2005-02-07 20:42     ` Brock
  0 siblings, 2 replies; 8+ messages in thread
From: Nicolas Dufour @ 2005-02-07 16:13 UTC (permalink / raw)
  Cc: caml-list

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 ....


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OCaml expression evaluated in a OCaml program
  2005-02-07 13:42 OCaml expression evaluated in a OCaml program Nicolas Dufour
@ 2005-02-07 16:17 ` sejourne_kevin
  2005-02-07 16:13   ` Nicolas Dufour
  0 siblings, 1 reply; 8+ messages in thread
From: sejourne_kevin @ 2005-02-07 16:17 UTC (permalink / raw)
  To: Nicolas Dufour; +Cc: caml-list

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


Kévin.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OCaml expression evaluated in a OCaml program
  2005-02-07 16:13   ` Nicolas Dufour
@ 2005-02-07 16:47     ` Jon Harrop
  2005-02-07 17:08       ` Yaron Minsky
                         ` (2 more replies)
  2005-02-07 20:42     ` Brock
  1 sibling, 3 replies; 8+ messages in thread
From: Jon Harrop @ 2005-02-07 16:47 UTC (permalink / raw)
  To: caml-list

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.


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OCaml expression evaluated in a OCaml program
  2005-02-07 16:47     ` Jon Harrop
@ 2005-02-07 17:08       ` Yaron Minsky
  2005-02-07 17:21       ` Vincenzo Ciancia
  2005-02-07 20:31       ` [Caml-list] " Robert Roessler
  2 siblings, 0 replies; 8+ messages in thread
From: Yaron Minsky @ 2005-02-07 17:08 UTC (permalink / raw)
  To: Jon Harrop; +Cc: caml-list

There's also Lua-ML, which is used by the C-- project as an embedded
scripting language.

http://www.cminusminus.org/code.html#luaml


On Mon, 7 Feb 2005 16:47:29 +0000, Jon Harrop <jon@jdh30.plus.com> wrote:
> 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.
> 
> _______________________________________________
> Caml-list mailing list. Subscription management:
> http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
> Archives: http://caml.inria.fr
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: OCaml expression evaluated in a OCaml program
  2005-02-07 16:47     ` Jon Harrop
  2005-02-07 17:08       ` Yaron Minsky
@ 2005-02-07 17:21       ` Vincenzo Ciancia
  2005-02-07 20:31       ` [Caml-list] " Robert Roessler
  2 siblings, 0 replies; 8+ messages in thread
From: Vincenzo Ciancia @ 2005-02-07 17:21 UTC (permalink / raw)
  To: caml-list

Jon Harrop wrote:

> 
> 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.

I believe there are "eval" implementations in the humps or around on the net
- there are also on-the-fly compilers and loaders.

V.

-- 
Please note that I do not read the e-mail address used in the from field but
I read vincenzo_ml at yahoo dot it
Attenzione: non leggo l'indirizzo di posta usato nel campo from, ma leggo
vincenzo_ml at yahoo dot it


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OCaml expression evaluated in a OCaml program
  2005-02-07 16:47     ` Jon Harrop
  2005-02-07 17:08       ` Yaron Minsky
  2005-02-07 17:21       ` Vincenzo Ciancia
@ 2005-02-07 20:31       ` Robert Roessler
  2 siblings, 0 replies; 8+ messages in thread
From: Robert Roessler @ 2005-02-07 20:31 UTC (permalink / raw)
  To: Caml-list

Jon Harrop wrote:

> ...
> 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.

Or there is Ocs (http://will.iki.fi/software/ocs/) - from their page:

"Ocs is an implementation of Scheme, as defined by R5RS. It is
implemented entirely in OCaml and is suitable for embedding in OCaml
programs. It is free, open source software, distributed under a
permissive (two-clause) BSD-style license."

Robert Roessler
robertr@rftp.com
http://www.rftp.com



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [Caml-list] OCaml expression evaluated in a OCaml program
  2005-02-07 16:13   ` Nicolas Dufour
  2005-02-07 16:47     ` Jon Harrop
@ 2005-02-07 20:42     ` Brock
  1 sibling, 0 replies; 8+ messages in thread
From: Brock @ 2005-02-07 20:42 UTC (permalink / raw)
  To: caml-list


Eh? In the archive message I gave an example of it being possible. I
even wrapped it up in a lovely library... see

  * http://thelackthereof.org/wiki.pl/OCaml_Eval

Though, as the website says, "This is a horrid thing that you probably
shouldn't do..."

If you want to do it the Right Way, then use MetaOCaml.

  * http://www.metaocaml.org/

--Brock

On 2005.02.07.11.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 ....
| 
| _______________________________________________
| Caml-list mailing list. Subscription management:
| http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list
| Archives: http://caml.inria.fr
| Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
| Bug reports: http://caml.inria.fr/bin/caml-bugs


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-02-07 20:42 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-07 13:42 OCaml expression evaluated in a OCaml program 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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).