Thank you for your answer. I still have no clue how to use it, or even pretty-print from that AST. Is there a simple way to do so ? Is there a documentation on using basic caml elements, like building an AST from a string of ocaml code, typing, type-checking, transforming and prettyprinting from this AST ?
-- Martin Le 09/06/2010 00:46, Ruslan Ledesma Garza a écrit : > Hello Martin, > > Looking at toploop.ml in 3.11.1, a line reads: > > let (str, sg, newenv) = Typemod.type_structure oldenv sstr Location.none > > I believe str contains the AST you are looking for. > > Best regards, > Ruslan. > > On Jun 8, 2010, at 11:29 PM, Martin Potier wrote: > >> Dear List, >> >> I have a school research assignment about defunctionalization. >> >> I'd like to implement a defunctionalization algorithm for Caml, using >> Caml, that's why I'd like to know if there is a way to retrieve a typped >> AST from Caml. >> >> I had a look at the option -dparsetree of the Caml interpreter, but it >> doesn't fit my need for two reasons : first it's not typped, and second >> it's not easily reusable. >> >> In a way, I just want to "plug in" right after the typing of the Caml >> AST in order to reuse it. >> >> Does anyone know the Caml source well enough to point me to a place >> where a function uses a typped AST ? >> >> -- >> Martin Potier >> >> _______________________________________________ >> 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 > _______________________________________________ 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