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 SAA08797; Mon, 12 Nov 2001 18:20:51 +0100 (MET) 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 SAA08117 for ; Mon, 12 Nov 2001 18:20:50 +0100 (MET) Received: from c007.snv.cp.net (c007-h014.c007.snv.cp.net [209.228.33.221]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id fACHKnH05729 for ; Mon, 12 Nov 2001 18:20:49 +0100 (MET) Received: (cpmta 13862 invoked from network); 12 Nov 2001 09:20:47 -0800 Received: from 65.187.194.217 (HELO vaiobambino) by smtp.directvinternet.com (209.228.33.221) with SMTP; 12 Nov 2001 09:20:47 -0800 X-Sent: 12 Nov 2001 17:20:47 GMT From: "Jeff Henrikson" To: "Mark Seaborn" , Subject: [Caml-list] GCCXML: don't write your own C parser. (WAS: Rewriting UNIX . . .) Date: Mon, 12 Nov 2001 12:33:47 -0500 Message-ID: <003701c16ba0$2f562a40$0b01a8c0@mit.edu> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 In-Reply-To: <20011112133937D.mrs35@cam.ac.uk> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > You may be interested in a project I am implementing at the moment: > The idea is to automatically translate any C program into a > memory-safe language. . . You're obviously going to need a parser and I presume you don't want to write one. Make sure to check out this extenion to GCC which prints out an XML abstract syntax tree of anything GCC can parse. http://public.kitware.com/GCC_XML/ Note that this is not _real_ XML, as there is no DTD. But the file xml.c could be easily hand translated into a recursive set of variants that would be about 150 lines of caml, along with a simple stream parser could do the task of building the tree. I'm going to write such a thing Real Soon Now, as I think it would be especally interestng to do other sorts of C/C++ metalingustic hacking on account of the vast amount of available code. (But if you really need it, don't wait for me, as I get busy often) If anybody reads the GCCXML link and thinks of the most obvious application of stub-code generators for FFI mucking, that's both why it was written and why I'm playing with GCCXML. CamlIDL requires too much manual effort; I think the best evidence is hearing/seeing so many hand written wrappers. I see no reason for directly handling the raw C code. I want something like the SWIG typemap model but cleaner, with an emphasis on not having to edit the original header files. I went so far as to mostly implementing a SWIG 1.3.7 module for ocaml, so I see it's strengths and weaknesses. But SWIG is not probably going to be a correct or clean program any time soon, so I'd like to clean it up and add some power. If anybody wants more info I can prodded to write it down for you. Jeff Henrikson ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr