* GNU C parser prototype in Caml
@ 2001-02-10 19:10 Pascal Brisset
0 siblings, 0 replies; only message in thread
From: Pascal Brisset @ 2001-02-10 19:10 UTC (permalink / raw)
To: caml-list
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-02-10 21:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-10 19:10 GNU C parser prototype in Caml Pascal Brisset
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox