caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* ocaml ast to machine at runtime
@ 2009-03-05 14:59 Joel Reymont
  2009-03-05 15:55 ` Sylvain Le Gall
  0 siblings, 1 reply; 3+ messages in thread
From: Joel Reymont @ 2009-03-05 14:59 UTC (permalink / raw)
  To: caml-list

I would like to compile trading systems written in a pascal-like  
programming language to OCaml AST at runtime, convert it to machine  
code and use it from the same running
OCaml program (natdynlink?).

Is it possible to do this without having gcc installed?

The code I'm generating will need to be iterate over an array of
doubles or be called from within the loop on every array element. It
will also use a bunch of helper functions from my existing library.

If I generate the code using LLVM then I'll need to write my helper
functions in C and the only value I get from OCaml would be the
parsing. If I write the helper functions in OCaml then I believe my
loop will be slow as hell due to all the wrapping and unwrapping of
OCaml values.

Any suggestions?

     Thanks, Joel

---
http://tinyco.de



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

* Re: ocaml ast to machine at runtime
  2009-03-05 14:59 ocaml ast to machine at runtime Joel Reymont
@ 2009-03-05 15:55 ` Sylvain Le Gall
  2009-03-05 16:26   ` [Caml-list] " Joel Reymont
  0 siblings, 1 reply; 3+ messages in thread
From: Sylvain Le Gall @ 2009-03-05 15:55 UTC (permalink / raw)
  To: caml-list

On 05-03-2009, Joel Reymont <joelr1@gmail.com> wrote:
> I would like to compile trading systems written in a pascal-like  
> programming language to OCaml AST at runtime, convert it to machine  
> code and use it from the same running
> OCaml program (natdynlink?).
>
> Is it possible to do this without having gcc installed?
>
> The code I'm generating will need to be iterate over an array of
> doubles or be called from within the loop on every array element. It
> will also use a bunch of helper functions from my existing library.
>
> If I generate the code using LLVM then I'll need to write my helper
> functions in C and the only value I get from OCaml would be the
> parsing. If I write the helper functions in OCaml then I believe my
> loop will be slow as hell due to all the wrapping and unwrapping of
> OCaml values.
>
> Any suggestions?

Why not using the LLVM OCaml binding? It is directly shipped with LLVM. 
So you can write the entire generator in OCaml...

Regards,
Sylvain Le Gall


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

* Re: [Caml-list] Re: ocaml ast to machine at runtime
  2009-03-05 15:55 ` Sylvain Le Gall
@ 2009-03-05 16:26   ` Joel Reymont
  0 siblings, 0 replies; 3+ messages in thread
From: Joel Reymont @ 2009-03-05 16:26 UTC (permalink / raw)
  To: Sylvain Le Gall; +Cc: caml-list


On Mar 5, 2009, at 3:55 PM, Sylvain Le Gall wrote:

> Why not using the LLVM OCaml binding? It is directly shipped with  
> LLVM.
> So you can write the entire generator in OCaml...


I would love to use LLVM. My concern is the overhead of calling from  
LLVM into OCaml, though. The code I'll be generating will need to make  
use of a library of functions.

I'd prefer to stay in OCaml so this library will need to be wrapped in  
C, if my understanding is correct. This implies manual labor to code  
the wrappers and the runtime overhead to invoke them.

	Thanks, Joel

---
http://tinyco.de
Mac, C++, OCaml




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

end of thread, other threads:[~2009-03-05 16:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-05 14:59 ocaml ast to machine at runtime Joel Reymont
2009-03-05 15:55 ` Sylvain Le Gall
2009-03-05 16:26   ` [Caml-list] " Joel Reymont

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