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.)
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.)
First Option Raw class : You can extract scanner and parser class from this application. Part 1 : the scanner Part 2 the parser and part 3 the main program, in this code snippet :
https://www.daniweb.com/software-development/csharp/threads/453104/parsing-c-code-using-c
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.
ANTLR can do what you'd like. It has a C preprocessor and ANSI C grammar.
https://github.com/antlr/grammars-v4