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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -