parsing - C source code lexical parser in Java -


i need lexical parser parse c source codes , have using java language. researched , saw antlr , javacc. of these parsers better use , why? or have other parser recommend?

answers appreciated. thanks.

a lexer breaks input stream tokens. don't count incomplete purpose of computing simple metrics.

if want differentiate "functions" "variables" you'll need kind of parser check sequences of tokens determine represent (e.g., "a variable declaration, use, or function declaration"). can build ad hoc parser may satisfy counting needs @ price of making occasional mistakes, or can real parser , right. (parsing c variable declaration lot harder looks @ first glance; pretty arcane syntax).

if homework, or real problem , don't care if answer wrong, lexer generator , ad hoc parsing code enough.

if want accurately, you'll need preprocessor , parser, , you'd better (implicitly including lexer).


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -