开发者

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


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

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


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜