RE: [Caml-list] How to write an efficient interpreter

2011-11-06 Thread Jon Harrop
If the language you are interpreting is quite declarative then piggy-backing on OCaml's run-time either by writing an interpreter or by compiling to OCaml code will be a big advantage. Writing a VM with a run-time as efficient as OCaml's in this context is a *lot* of work compared to writing an

Re: [Caml-list] How to write an efficient interpreter

2011-10-24 Thread Gabriel Scherer
Even staying at the interpreter stage, you can probably improve your performance seriously by being careful about your implementation : use efficient data structure (what is your implementation of variable lookup?), avoid unnecessary allocation, use tail-recursive functions where possible, etc.

Re: [Caml-list] How to write an efficient interpreter

2011-10-24 Thread Jérémie Dimino
Hi, On Mon, Oct 24, 2011 at 01:50:25PM +0200, Diego Olivier Fernandez Pons wrote: I was rather thinking of translating on-the-fly into Caml code and letting Caml do the job. Is that technically possible (rewriting a toplevel ? a CamlP4 grammar ?). If so guess I would have to license the Caml