[lug] parsing tool for linux

HEROLD Herold at Colorado.EDU
Sun Apr 7 15:45:35 MDT 2002


Hi folks!  I am looking for a tool that already knows C syntax, and can
output the results of a parsed C source file, one token per line.  I know
about some of the tools (like Bison) which can generate C files from a
grammar, but what I need to do is take something like the following in a
source file:

if(x==(testp(foobar))&&(func(y))){

and get back:

if
(
x
==
(
testp(
foobar
)
)
&&
(
func(
y
)
)
)
}

I need to build a language model so that I can start figuring out how to
make ViaVoice useful for programming; I planned on just using all of the
source code that ships with Linux and gcc.

Separated by spaces is fine, too, so long as the function names are
preserved as functions ( so that func(x) comes out func(, or func (x)
comes out func( )

For those of you who know what a language model is, it just models the
frequency of two words (tokens) occuring next to each other.  It is
a primary component in speech recognition.

I don't have the resources to write a C parser, and I have looked for
something that could output the parse tree, but couldn't find one (maybe I
don't know the right search string).

Any ideas?


--Keith




More information about the LUG mailing list