user541686
user541686

Reputation: 210785

C Code Parser for .NET

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.)

Upvotes: 6

Views: 3172

Answers (3)

Andrew T Finnell
Andrew T Finnell

Reputation: 13638

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

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

Upvotes: 7

Harshal Doshi  Jain
Harshal Doshi Jain

Reputation: 2597

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

Upvotes: 0

SK-logic
SK-logic

Reputation: 9725

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.

Upvotes: 5

Related Questions