From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA32317; Sat, 7 Jun 2003 15:40:49 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA31876 for ; Sat, 7 Jun 2003 15:40:48 +0200 (MET DST) Received: from hosting.commandprompt.com ([207.173.200.202]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id h57DekT02423 for ; Sat, 7 Jun 2003 15:40:47 +0200 (MET DST) Received: from respighi.local. (pool-68-160-1-138.bos.east.verizon.net [68.160.1.138]) (authenticated) by hosting.commandprompt.com (8.11.6/8.11.6) with ESMTP id h57DQcs26262; Sat, 7 Jun 2003 06:26:38 -0700 Date: Sat, 7 Jun 2003 09:41:41 -0400 Subject: Re: [Caml-list] CKit for O'Caml? Content-Type: text/plain; charset=US-ASCII; format=flowed Mime-Version: 1.0 (Apple Message framework v543) Cc: caml-list@inria.fr To: "Mary F. Fernandez" From: Jeff Henrikson In-Reply-To: <3EE1077A.4030802@research.att.com> Message-Id: Content-Transfer-Encoding: 7bit X-Mailer: Apple Mail (2.543) X-Spam: no; 0.00; henrikson:01 jehenrik:01 caml-list:01 frontc:01 cdk:01 structs:01 vars:01 unions:01 enums:01 smlnj:01 list's:99 973:99 mff:99 bug:01 faq:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk 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