caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jonathan Kimmitt<jonathan@kimmitt.co.uk>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Generating coinductive elements
Date: Tue, 1 May 2012 13:36:54 +0200	[thread overview]
Message-ID: <sympa.1335871775.30880.447@inria.fr> (raw)
In-Reply-To: 4F9EBF8C.2060309@cs.cornell.edu

Not sure if it useful for you but you can actually convert a
string/function/file into an ocaml phrase and execute it from within
a program, for example:

[jrrk100@angcatlnxsrv10 v2abc]$ ocaml
	Objective Caml version 3.12.0

# Toploop.execute_phrase true Format.err_formatter
((!Toploop.parse_toplevel_phrase) (Lexing.from_string "355./.113.;;"));;
- : float = 3.14159292035398252
- : bool = true
# 
[jrrk100@angcatlnxsrv10 v2abc]$ 

I demonstrate it from within the toplevel interpreter but there is nothing to
stop you compiling with the Toploop library into an executable. This works with
bytecode, I have not tried it with ocamlnat(the native top-level)

             reply	other threads:[~2012-05-01 11:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-01 11:36 Jonathan Kimmitt [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-04-30 16:36 Jean-Baptiste Jeannin
2012-04-30 16:50 ` Xavier Leroy

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=sympa.1335871775.30880.447@inria.fr \
    --to=jonathan@kimmitt.co.uk \
    --cc=caml-list@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;
as well as URLs for NNTP newsgroup(s).