Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Roslyn for a new language implementation

I was exploring ways how to implement a general-purpose/DSL language for .NET platform. From what I saw, there are several tools that make language implementation (parsing source code) relatively easy. Irony, Yacc, ANTLR… the problems with these projects are that some are not evolving, some generate slow parsers, some cannot run on .NET Core CLR etc. There is always some obstacle that pushes me towards solution “write your own parser”.

So I was wondering… is it possible to write my own parser and connect/integrate it with Roslyn? Are there any books, tutorials or examples how it can be done?

like image 222
user1498611 Avatar asked Jan 13 '16 20:01

user1498611


2 Answers

I know this is an old thread, but your best bet (in visual studio at least) is to create an IVsSingleFileGenerator that converts your code into c# or other Roslyn language.

like image 94
quelbe Avatar answered Sep 23 '22 19:09

quelbe


Roslyn does not allow to do it.

Look at this project: Nitra. It's under active development.

like image 45
Memoizer Avatar answered Sep 19 '22 19:09

Memoizer