Skip to content

Does an Antlr4 g4 grammar exist for recent versions of C# #7379

Answered by 333fred
DavidArno asked this question in Q&A
Discussion options

You must be logged in to vote

https://github.com/dotnet/roslyn/blob/main/src/Compilers/CSharp/Portable/Generated/CSharp.Generated.g4

This is the only one I'm aware of, but it does have some problems when being considered for actual use:

  • It's based on our syntax node structure, which is more permissive than C#'s actual grammar for error recovery purposes.
  • We don't actually test it, so it's possible it has bugs or things that don't quite work in real antlr. We mainly just use it for code review of new syntax nodes.

Replies: 2 comments 6 replies

Comment options

You must be logged in to vote
4 replies
@DavidArno
Comment options

@CyrusNajmabadi
Comment options

@DavidArno
Comment options

@CyrusNajmabadi
Comment options

Answer selected by DavidArno
Comment options

You must be logged in to vote
2 replies
@CyrusNajmabadi
Comment options

@DavidArno
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants