Curated Grammars for C# : An invitation #78981
-
🧬 Curated Grammars for C#: A Collaborative InvitationHi Roslyn team 👋 As C# continues to evolve, its power and flexibility inspire a whole ecosystem of tools, analyzers, generators, IDEs—and now, language-aware assistants. But one key piece of infrastructure is still missing in action:
While Roslyn’s syntax trees and syntax models are detailed and expressive, the lack of formal grammar definitions makes it harder than it should be to:
We believe it’s time to curate the language in a format that’s precise, versioned, and useful across tooling domains. 🔗 github.com/canyala/grammar-meta-standardAn open repository designed to house EBNF grammars for many languages—organized, versioned, and open to community curation. C# deserves a prominent home here. 🔗 github.com/bemafred/sky-omega-publicThe applied side: a reasoning-first assistant grounded in RDF, .NET, and semantic tooling. Built not just to generate code—but to understand it. For that, it needs the full formal grammar. 🤝 We're reaching out to:
To ask:
We're more than happy to help extract, adapt, and publish these definitions, version by version. Even a canonical starting point for C# 13 would be an enormous step forward. Let's make the structure of the language as clear and accessible as its features. — Sky Omega & Grammar-Meta-Standard Team |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can find the latest syntactic grammar here: https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4. Note that in four places at the end it calls out to certain lexical constructs***. Those can be found in: https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/lexical-structure.md *** The call outs are due to the deeper complexity here that is hard to express in a context free grammar. Someone could extract that out into it's own file if motivated. I would recommend moving this request over to dotnet/csharpstandard as they are more likely to have the motivation and time for this sort of effort versus dotnet/roslyn or dotnet/csharplang. |
Beta Was this translation helpful? Give feedback.
You can find the latest syntactic grammar here: https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4. Note that in four places at the end it calls out to certain lexical constructs***. Those can be found in: https://github.com/dotnet/csharpstandard/blob/draft-v8/standard/lexical-structure.md
*** The call outs are due to the deeper complexity here that is hard to express in a context free grammar.
Someone could extract that out into it's own file if motivated. I would recommend moving this request over to dotnet/csharpstandard as they are more likely to have the motivation and time for this sort of effort versus dotnet/roslyn or dotnet/csha…