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 CAA16451; Tue, 13 Nov 2001 02:00:09 +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 CAA15962 for ; Tue, 13 Nov 2001 02:00:07 +0100 (MET) Received: from gogol.zorgol (Mix-Montsouris-110-2-50.abo.wanadoo.fr [193.248.189.50]) by nez-perce.inria.fr (8.11.1/8.10.0) with SMTP id fAD106H11014 for ; Tue, 13 Nov 2001 02:00:06 +0100 (MET) Received: (qmail 27204 invoked by uid 1001); 13 Nov 2001 00:53:14 -0000 Date: Tue, 13 Nov 2001 01:53:14 +0100 From: Berke Durak To: Jeff Henrikson Cc: caml-list@inria.fr, Mark Seaborn Subject: Re: [Caml-list] GCCXML: don't write your own C parser. (WAS: Rewriting UNIX . . .) Message-ID: <20011113015314.A13191@gogol.zorgol> References: <20011112133937D.mrs35@cam.ac.uk> <003701c16ba0$2f562a40$0b01a8c0@mit.edu> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <003701c16ba0$2f562a40$0b01a8c0@mit.edu>; from jehenrik@yahoo.com on Mon, Nov 12, 2001 at 12:33:47PM -0500 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Mon, Nov 12, 2001 at 12:33:47PM -0500, Jeff Henrikson wrote: > > 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. . . Sounds particularly interesting. > 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/ > Very good idea. Indeed I got that idea about rewriting UNIX in Caml last day when I was trying to Camlify a YACC grammar for ANSI C. And most programs are far from being ANSI C (everyone has certainly used GNU extensions ?). So, since we're fighting against C, and since GNU C is the most widespread GNU compiler, directly using GNU C's output seems to be the most useful approach. Since Caml is dependent on C, it would be fair enough to be able to easily manipulate C programs in Caml. > 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) A well-designed C syntax module, both parsing and unparsing, would be really great. It would be very useful for : 1) Emitting C code (could be applied to FFTW or CamlIDL) 2) Creating automatic code obfuscators 3) Playing with C semantics (experiments in model-checking etc.) A C ``interpreter'' could be thus written. I've already seen a Java course taught using Caml. It could be useful for teaching (eg. ``Exercice. Write a Caml program that removes for-loops from C programs'')... -- Berke ------------------- 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