Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] CKit for O'Caml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jeff Henrikson <jehenrik@y...>
Subject: Re: [Caml-list] CKit for O'Caml?
I use the frontc package, by Hugues Casse, which you can find in the 
Caml Development Kit. (cdk)  There is an AST, parser, and pretty 
printer.  My only two difficulties with it have been:

- it can't parse the ":" operator for denoting bit fields in structs.

- it took me a while to figure out how to access what I want out of the 
AST.  The three constructors TYPEDEF, ONLYTYPEDEF and DECDEF have a lot 
of crossover, and I never figured out exactly why, but that if I 
projected these out with a filter function

   let simplify_def def =
     match def with
       (Cabs.TYPEDEF(bt0,_,vars)) -> Some (bt0,vars)
     | (Cabs.ONLYTYPEDEF(bt0,_,vars)) -> Some (bt0,vars)
     | (Cabs.DECDEF(bt0,_,vars)) -> Some (bt0,vars)
     | _ -> None;;

that I got access to the structs, unions and enums more easily.  The 
messiest part of my code ended up being the "view" I wrapped around the 
AST.


Jeff Henrikson



On Friday, June 6, 2003, at 05:28 PM, Mary F. Fernandez wrote:

> Does anyone know if there are any O'Caml tools similar to the SML CKit
> (http://www.smlnj.org/doc/ckit/).  I've searched comp.lang.ml, this
> mailing list's archives and looked at "The Hump", but no luck.
> In particular, I'm most interested in the C AST and pretty printer.
>
> I hope it's OK to ask this question here!
> Thanks,
> Mary
> -- 
> Mary Fernandez, Principal Technical Staff Member
> AT&T Labs - Research, 180 Park Ave., Room E243, Florham Park, NJ 
> 07932-0971
> phone: 973-360-8679,  fax: 973-360-8187
> mff@research.att.com, http://www.research.att.com/~mff
>
>
> -------------------
> To unsubscribe, mail caml-list-request@inria.fr Archives: 
> http://caml.inria.fr
> Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: 
> http://caml.inria.fr/FAQ/
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
>

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners