antlr / grammars-v4

Grammars written for ANTLR v4; expectation that the grammars are free of actions.
MIT License
10.16k stars 3.7k forks source link

[csharp] Microsoft is now using antlr for grammar "officially" #819

Open xied75 opened 7 years ago

xied75 commented 7 years ago

A surprise to me that I just found this: https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/

If you click into a page, e.g. https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/language-specification/attributes you can see the grammar is in antlr

Guess this is really great! @parrt

I wonder should whoever interested in C# grammar chime in on the issue that "Should we try to unify the current g4 with MS work, then improve on to add C# 7 features?" @KvanTTT @sharwell

Chris2011 commented 7 years ago

Yes please, an official grammar is much way better. This is a great news.

teverett commented 7 years ago

I'm not so sure. The grammar on the MS tree may be encumbered MS Property.

sharwell commented 7 years ago

The grammar is using ANTLR form more as a communication mechanism. The syntax is well understood by readers and works well with GitHub's available syntax highlighting features. I wouldn't expect it to work in unaltered form (e.g. possible ambiguities, preprocessor).

Chris2011 commented 7 years ago

What is the outcome of this?

teverett commented 7 years ago

I'm not sure that there is one. Were you expecting one?

Chris2011 commented 7 years ago

You closed the ticket, because of? That's why I'm asking.

teverett commented 7 years ago

I didn't see a need for further discussion. If you disagree you are absolutely welcome to re-open the ticket and explain what further action you are expecting.

Chris2011 commented 7 years ago

Does the thing, what @sharwell said, prevent us/you from using the antlr stuff, coming from MS for C#?

teverett commented 7 years ago

I am not a lawyer, and am not able to comment on that. In any case would you like the issue to remain open?

Chris2011 commented 7 years ago

I vote for give it a try to use the "more official" one, that MS maybe provides by there own on the MSDN page, to collect everything what we need. I only mean, as technical perspective, does the comment from @sharwell prevents us from using it, because it is ANTLR but in an other way and it is much more work for us to change the code, instead of using and enhance that one, that we have? If not, than I'm for opening the issue again. But of course, we need more disucssion here. I know there is a gitter chan for ANTLR for CS. It is a big topic, I think.

teverett commented 7 years ago

I don't see anything wrong with that suggestion. If it works for you then I will re-open this PR and label it with "grammar requests" since it would take some effort.

Chris2011 commented 7 years ago

Ok, let's do it.

KvanTTT commented 4 years ago

I think it makes sense to add the link to csharp directory about autogenerated ANTLR grammar from Roslyn repository. We have the same description for MySql and other grammars.