5

I want to write a program in C# that uses a library to parse C source files, and provides me with a data structure containing all the functions and parameters associated found in it.

I don't need to know what is actually inside the function or anything else for that matter.

What would be a good library to do that?

1
  • Is there any alternative to ANTLR? I honestly can't for the life of me make it work with Visual Studio C# Express 2010... The documentation is a mess Commented Aug 11, 2011 at 9:50

1 Answer 1

7

ANTLR can do what you'd like. It has a C preprocessor and ANSI C grammar.

(http://www.antlr.org/grammar/list)

Sign up to request clarification or add additional context in comments.

5 Comments

Thanks for this, this thing is really overwhelming tho. If I understand correctly, I must use the ANSI C grammar file to generate the source file that I'll use in my C# application? What is the use of the C Preprocessor? And also how do I use it? There is no Readme coming with it
I've used this page antlr.org/wiki/pages/viewpage.action?pageId=557075 to try and use it from Visual C# Express 2010 but I get the following error message : The type or namespace name 'GrammarRuleAttribute' could not be found (are you missing a using directive or an assembly reference?). I guess I should ask the ANTLR forums!
@Leo: I honestly have never used ANTLR, I only know what it can do. Maybe this should be another SO question on question on the ANTLR forums?
oh okay, thought you knew it. Thanks for all the input and sorry to be a pain haha! I'll go ask the ANTLR people.
@Leo: Sorry if I implied that. I am just here to help :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.