Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C Code Parser for .NET

Tags:

c

c#

.net

parsing

Does anyone know of any C parser library for .NET?

(I'm intending to parse C code into some form of object graph, so I can convert it to a different language.)

like image 287
user541686 Avatar asked Jan 07 '11 16:01

user541686


2 Answers

A proper C99 grammar is not that trivial. It's better to use a proven C parser (e.g., Clang). It is possible to use it with .NET via C++/CLI.

like image 44
SK-logic Avatar answered Oct 02 '22 06:10

SK-logic


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

https://github.com/antlr/grammars-v4

like image 179
Andrew T Finnell Avatar answered Oct 02 '22 06:10

Andrew T Finnell