Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where can I find C# 3.0 grammar?

I'm planning to write a C# 3.0 compiler in C#. Where can I get the grammar for parser generation?

Preferably one that works with ANTLR v3 without modification.

like image 472
mmx Avatar asked Oct 13 '09 16:10

mmx


People also ask

Where do I find C?

Where will I be able to find C drive in windows 10 laptops ? Broadly the same as previous versions of Windows, click on file explorer, click on This PC, you'll find the C drive there.

How do I find the C drive in Windows 10?

Your file explorer should appear by default on your task bar; it's icon looks like a file folder. If you don't have access to that shortcut, you can just type "this pc" or "file explorer" into the search box, and to get to your C: drive, just type "c:" into the same box.

Where is my local disk C?

Please be informed that you can go to local disk C: drive in Windows 10 by pressing Windows + E key from the Windows that appears, on the left hand side you will see This PC click on it and all the drives will be expanded. Click on C: Drive.


2 Answers

Take a look at C# Language Specification. In the chapter B. Grammar you'll find the grammar.

like image 70
Michael Damatov Avatar answered Sep 28 '22 07:09

Michael Damatov


I ran into ANTLR C# Grammar on CodePlex. It's a relatively new project and uses ANTLR 3.2. It says it supports C# 4.0 and is licensed under the Eclipse Public License (EPL).

I played with it a little. It has a bunch of test files containing expressions. It supports lambdas, unsafe context, ... as you'd naturally expect. It parses a C# file and hands you an abstract syntax tree. You can do whatever you want with it.

like image 40
mmx Avatar answered Sep 28 '22 07:09

mmx