Re: [Caml-list] Generation of Java code from OCaml

2009-10-03 Thread Anil Madhavapeddy
On 3 Oct 2009, at 18:27, blue storm wrote: On Sat, Oct 3, 2009 at 2:16 PM, Anil Madhavapeddy wrote: The only thing I haven't quite worked out yet is the quotation to pattern-match type applications to detect things like "(string, unit) Hashtbl.t" the way the current json-static does via the g

Re: [Caml-list] Generation of Java code from OCaml

2009-10-03 Thread blue storm
On Sat, Oct 3, 2009 at 2:16 PM, Anil Madhavapeddy wrote: > The only thing I haven't quite worked out yet is the quotation to > pattern-match type applications to detect things like "(string, unit) > Hashtbl.t" the way the current json-static does via the grammar extension. > -anil Below are two p

Re: [Caml-list] Generation of Java code from OCaml

2009-10-03 Thread Anil Madhavapeddy
On 24 Sep 2009, at 13:19, Martin Jambon wrote: Oh yes, there's type-conv too. I don't know the pros and cons of using either type-conv or deriving. If anyone knows, a brief comparison would be helpful. The nice thing about using type-conv is that syntax extensions can be composed qui

Re: [Caml-list] Generation of Java code from OCaml

2009-09-26 Thread ygrek
On Thu, 24 Sep 2009 14:02:14 +0200 blue storm wrote: > What about factorising json-static to allow adding arbitrary code > generators (represented as functions from (string * type_def) list to > a camlp4 Ast) at camlp4-time ? You would have a design similar to > type-conv, wich allows adding new

Re: [Caml-list] Generation of Java code from OCaml

2009-09-24 Thread Martin Jambon
blue storm wrote: > On Thu, Sep 24, 2009 at 1:18 PM, Martin Jambon > wrote: >> Yes, patching the original code of json-static would work but it's not ideal. > >>From the example given, it seems that the original poster already uses > json-static. In that case, I think that reusing the code logic

Re: [Caml-list] Generation of Java code from OCaml

2009-09-24 Thread blue storm
On Thu, Sep 24, 2009 at 1:18 PM, Martin Jambon wrote: > Yes, patching the original code of json-static would work but it's not ideal. >From the example given, it seems that the original poster already uses json-static. In that case, I think that reusing the code logic is a good idea (coherent beh

Re: [Caml-list] Generation of Java code from OCaml

2009-09-24 Thread Martin Jambon
blue storm wrote: > In case it helps, below is a basic patch against json-static (SVN > trunk, 3.10 version). On your example it produces the following code : [...] Yes, patching the original code of json-static would work but it's not ideal. Maybe Deriving is a better choice (http://code.google.

Re: [Caml-list] Generation of Java code from OCaml

2009-09-24 Thread blue storm
In case it helps, below is a basic patch against json-static (SVN trunk, 3.10 version). On your example it produces the following code : let javadef_of_create_order_response = "public class Create_order_response {\n\tprivate int order_id;\n\tprivate String order_code;\n\tprivate int order_price;

RE: [Caml-list] Generation of Java code from OCaml

2009-09-24 Thread David Allsopp
Mykola Stryebkov wrote: > Hi, Richard. > > On 23 Вер 2009, at 22:57, Richard Jones wrote: > I'm going to use stringing bits of text together. But text generating > is not an issue here. The issue is how to make this stringing driven by > description of ocaml records. camlp4 would be the neate

Re: [Caml-list] Generation of Java code from OCaml

2009-09-23 Thread Mykola Stryebkov
Hi, Richard. On 23 Вер 2009, at 22:57, Richard Jones wrote: On Wed, Sep 23, 2009 at 09:15:08PM +0300, Mykola Stryebkov wrote: I need to generate arbitrary text (more specifically, Java code) from Ocaml structures, pretty similar to how json-static lib generates ocaml code from ocaml structures

Re: [Caml-list] Generation of Java code from OCaml

2009-09-23 Thread Richard Jones
On Wed, Sep 23, 2009 at 09:15:08PM +0300, Mykola Stryebkov wrote: > I need to generate arbitrary text (more specifically, Java code) from > Ocaml structures, pretty similar to how json-static lib generates > ocaml code from ocaml structures. > > Which approach would you recommend? > Is it poss

[Caml-list] Generation of Java code from OCaml

2009-09-23 Thread Mykola Stryebkov
Hi, I need to generate arbitrary text (more specifically, Java code) from Ocaml structures, pretty similar to how json-static lib generates ocaml code from ocaml structures. Which approach would you recommend? Is it possible to use ocamlp4 for it? -- Mykola Stryebkov Blog: http://mykola.or