From: James A. Crippen
Subject: C parser
Date: 
Message-ID: <m3adzcvtno.fsf@kappa.unlambda.com>
I need code to parse entire files in C and hand me back something like
a parse tree of tokens that represents the contents of that file.  I
started to write one myself but realized that someone somewhere must
have done the same before.  Does anyone know of such a beast?

(thanks :in-advance t)
'james

-- 
James A. Crippen <·····@unlambda.com> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.

From: James A. Crippen
Subject: Re: C parser
Date: 
Message-ID: <m366a0vtgs.fsf@kappa.unlambda.com>
·····@unlambda.com (James A. Crippen) writes:

> I need code to parse entire files in C and hand me back something like
> a parse tree of tokens that represents the contents of that file.  I
> started to write one myself but realized that someone somewhere must
> have done the same before.  Does anyone know of such a beast?

What I clearly want to do is not exactly clear above.  (It isn't
rooted in NCOMPLR though.)  I meant that I want some CL code to parse
C files into parse trees.  Not code in C to parse random files.

'james

-- 
James A. Crippen <·····@unlambda.com> ,-./-.  Anchorage, Alaska,
Lambda Unlimited: Recursion 'R' Us   |  |/  | USA, 61.2069 N, 149.766 W,
Y = \f.(\x.f(xx)) (\x.f(xx))         |  |\  | Earth, Sol System,
Y(F) = F(Y(F))                        \_,-_/  Milky Way.
From: Vebjorn Ljosa
Subject: Re: C parser
Date: 
Message-ID: <cy3wv2fnabc.fsf@ljosa.com>
* ·····@unlambda.com (James A. Crippen)
| I need code to parse entire files in C and hand me back something like
| a parse tree of tokens that represents the contents of that file.  I
| started to write one myself but realized that someone somewhere must
| have done the same before.  Does anyone know of such a beast?

There is something called Zebu, which is an LALR(1) parser generator
written in Common Lisp.  See <URL:http://ww.telent.net/cliki/Zebu>.

Of course you'll also need a Zebu grammar for C, and I don't know if
that exists already.  Looking at one of the countless Yacc grammars
for C might make it easier to write one; check out GNU Indent and
similar programs.

Another starting point is Cparse, which is a Common Lisp library for
parsing C header files.  See <URL:http://ww.telent.net/cliki/cparse>.

-- 
Vebjorn Ljosa
From: Masoud Pirnazar
Subject: Re: C parser
Date: 
Message-ID: <9plt81$kbo@dispatch.concentric.net>
there's a c parser in the scheme archives (i think at cmu ai repository)

first two lines of the code are:
; Author: Mohd Hanafiah Abdullah (····@cs.indiana.edu or ····@ms.mimos.my)
; Please report any bugs that you find.  Thanks.

if you're interested and can't find it, let me know and i'll email it to
you.  it's about 19KB, "cgram.scm".