From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id WAA01000 for caml-red; Sat, 10 Feb 2001 22:49:18 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id UAA21305 for ; Sat, 10 Feb 2001 20:16:15 +0100 (MET) Received: from caroubier.wanadoo.fr (smtp-rt-5.wanadoo.fr [193.252.19.159]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f1AJGFD07570 for ; Sat, 10 Feb 2001 20:16:15 +0100 (MET) Received: from mahonia.wanadoo.fr (193.252.19.58) by caroubier.wanadoo.fr; 10 Feb 2001 20:16:15 +0100 Received: from whynot.localdomain (193.248.8.86) by mahonia.wanadoo.fr; 10 Feb 2001 20:16:05 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <14981.37443.521758.10069@whynot.localdomain> Date: Sat, 10 Feb 2001 20:10:59 +0100 From: Pascal Brisset To: caml-list@inria.fr Subject: GNU C parser prototype in Caml X-Mailer: VM 6.87 under Emacs 20.5.1 Sender: weis@pauillac.inria.fr There were discussions about parsing ANSI C with Caml a few weeks ago. I recently tried to write a parser for a significant subset of GNU C. Basically, it parses most of the Linux kernel source tree, including the challenging GNU C "features" demonstrated in: int a, b; typedef int t, u; void f1() { a * b; } void f2() { t * u; } void f3() { t * b; } void f4() { int t; t * b; } void f5(t u, unsigned t) { switch ( t ) { case 0: if ( u ) default: return; } } (After realizing that this is legal gcc code, I gave up on fixing the last few grammar conflicts. Also, I have no idea whether it is actually safe to do side effects between ocaml's parser and lexer.) The code is currently part of a larger project distributed at : http://perso.wanadoo.fr/pascal.brisset/kernel3d/kernel3d.html Fixes are welcome. -- Pascal Brisset