简体   繁体   English

C#5.0 EBNF语法

[英]C# 5.0 EBNF grammar

I am looking for an EBNF grammar of the programming language C# in the Version 5.0. 我在5.0版中寻找编程语言C#的EBNF语法。 This grammar should be machine readable, so I am able to do some processing with this EBNF grammar 这个语法应该是机器可读的,所以我能够用这个EBNF语法做一些处理

Until now I found out that the language specification document of C# is included in the installation of Visual Studio ( %PROGRAMFILES(x86)%\\Microsoft Visual Studio 12.0\\VC#\\Specifications\\1033 ) this document already includes the BNF grammar embedded in the document. 到目前为止,我发现C#的语言规范文档包含在Visual Studio的安装中( %PROGRAMFILES(x86)%\\Microsoft Visual Studio 12.0\\VC#\\Specifications\\1033 )这个文件已经包含了嵌入的BNF语法文献。 However, this is only in BNF syntax and not EBNF and it is embedded in the *.docx document an no separate file, which means it is not sufficient for me. 但是,这只是在BNF语法中而不是EBNF,并且它在* .docx文档中嵌入了一个没有单独的文件,这意味着它对我来说还不够。

Additionally I found these resources: 另外我找到了这些资源:

  • MSDN Blog : This is a EBNF grammar for C# version 4.0 MSDN博客 :这是C#4.0版的EBNF语法
  • slps.github.io : This contains the extracted BNF Grammar for C# Version 4.0 slps.github.io :这包含C#Version 4.0提取的BNF语法

So these resources are not sufficient for my project. 所以这些资源对我的项目来说还不够。 Do you know a complete EBNF grammar for C# 5.0? 你知道C#5.0的完整EBNF语法吗?

I know you're looking for a C# 5.0 Grammar, but there is an ANTLR grammar for c# 6.0 at github . 我知道你正在寻找一个C#5.0语法,但是github上的 c#6.0有一个ANTLR语法。 ANTLR uses a kind of EBNF notation and can be parsed by a computer. ANTLR使用一种EBNF表示法,可以由计算机解析。 If you want ANTLR allows you to generate a parser for C# from that grammar. 如果您希望ANTLR允许您从该语法生成​​C#的解析器。 Since C# 6.0 is a superset of C# 5.0, the Version difference shouldn't matter. 由于C#6.0是C#5.0的超集,因此版本差异无关紧要。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM