caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Berke Durak <berke@altern.org>
To: Jeff Henrikson <jehenrik@yahoo.com>
Cc: caml-list@inria.fr, Mark Seaborn <mrs35@cam.ac.uk>
Subject: Re: [Caml-list] GCCXML: don't write your own C parser. (WAS: Rewriting UNIX . . .)
Date: Tue, 13 Nov 2001 01:53:14 +0100	[thread overview]
Message-ID: <20011113015314.A13191@gogol.zorgol> (raw)
In-Reply-To: <003701c16ba0$2f562a40$0b01a8c0@mit.edu>; from jehenrik@yahoo.com on Mon, Nov 12, 2001 at 12:33:47PM -0500

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


  reply	other threads:[~2001-11-13  1:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-11  5:17 [Caml-list] Rewriting UNIX in Caml and getting rid of the C disease Berke Durak
2001-11-11  6:11 ` Eric Newhuis
2001-11-11  8:22   ` Tom
2001-11-11 12:47 ` Sven
2001-11-11 13:32 ` Julian Assange
2001-11-12  8:32 ` Jeff Henrikson
2001-11-12 13:39 ` Mark Seaborn
2001-11-12 17:33   ` [Caml-list] GCCXML: don't write your own C parser. (WAS: Rewriting UNIX . . .) Jeff Henrikson
2001-11-13  0:53     ` Berke Durak [this message]
2001-11-13  5:10       ` Julian Assange

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011113015314.A13191@gogol.zorgol \
    --to=berke@altern.org \
    --cc=caml-list@inria.fr \
    --cc=jehenrik@yahoo.com \
    --cc=mrs35@cam.ac.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).