Using Roslyn for a new language implementation

I studied how to implement the general purpose language / DSL for the .NET platform. From what I saw, there are several tools that make implementing a language (source code analysis) relatively easy. Irony, Yacc, ANTLR ... problems with these projects are that some of them do not develop, some generate slow parsers, some of them cannot work on .NET Core CLR, etc. There is always some kind of obstacle that pushes me to the decision "write your own parser."

So, I was wondering ... Can I write my own parser and connect / integrate it with Roslyn? Are there any books, textbooks, or examples of how this can be done?

+6
source share
2 answers

Roslyn does not allow this.

Take a look at this project: Nitra . He is actively developing.

+3
source

Roslyn is not intended for this.

The best thing you can do with Roslyn is to generate C # (or VB) syntax and compilation after you manually parse your language, letting Roslyn take care of the type system and codegen.

And this will only work for everyone if your language can be fully translated into C # (or VB) syntax.

+7
source

All Articles