C# 解析器 [英] Parser for C#

查看:57
本文介绍了C# 解析器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪些解析器可用于解析 C# 代码?

Which parsers are available for parsing C# code?

我正在寻找一个可以在 C# 中使用的 C# 解析器,让我可以访问有关所分析代码的每个人工制品的行和文件信息.

I'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code.

推荐答案

处理源代码:

  • CSParser: From C# 1.0 to 2.0, open-source
  • Metaspec C# Parser: From C# 1.0 to 3.0, commercial product (about 5000$)
  • #recognize!: From C# 1.0 to 3.0, commercial product (about 900€) (answer by SharpRecognize)
  • SharpDevelop Parser (answer by Akselsson)
  • NRefactory: From C# 1.0 to 4.0 (+async), open-source, parser used in SharpDevelop. Includes semantic analysis.
  • C# Parser and CodeDOM: A complete C# 4.0 Parser, already support the C# 5.0 async feature. Commercial product (49$ to 299$) (answer by Ken Beckett)
  • Microsoft Roslyn CTP: Compiler as a service.

组装工作:

  • System.Reflection
  • Microsoft Common Compiler Infrastructure: From C# 1.0 to 3.0, Microsoft Public License. Used by Fxcop and Spec#
  • Mono.Cecil: From C# 1.0 to 3.0, open-source

程序集解析"的问题是我们关于行和文件的信息较少(信息基于.pdb文件,而Pdb只包含方法的行信息)

The problem with assembly "parsing" is that we have less informations about line and file (the informations is based on .pdb file, and Pdb contains lines informations only for methods)

我个人推荐 Mono.CecilNRefactory.

这篇关于C# 解析器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆