Getting started with ANTLR in C#

Readers of this website will know that ANTLR is a great tool to quickly create parsers and help you in working with a known language or create your DSL. While the tool itself is written in Java, it can also be used to generate parsers in several other languages, for instance Python, C# or Javascript (with […]

Problems and Strategies to Port from Javascript to C#

Translate Javascript to C#

Let’s say you need to automatically port some code from one language to another, how are going to do it? Is it even possible? Maybe you have already seen a conversion between similar languages, such as Java to C#. That sounds much simpler in comparison. In this article we are going to discuss some strategies […]

Code Generation with Roslyn: a Skeleton Class from UML

Code Generation with Roslyn: a Skeleton Class from UML

We have already seen some examples of transformation and analysis of C# code with Roslyn. Now we are going to see how to create a more complex example of code generation with Roslyn and parsing with Sprache. We are going to create a skeleton class from a PlantUML file. In short, we are doing the […]

Create a simple parser in C# with Sprache

Create a simple parser in C# with Sprache

Everybody loves ANTLR, but sometimes it may be overkill. On the other hand, a regular expression just doesn’t cut it or it may be too complicated to maintain. What a developer can do in such cases ? He uses Sprache. As its creators say: Sprache is a simple, lightweight library for constructing parsers directly in […]

Representation of the world inspired by Matrix

Generate diagrams from C# source code using Roslyn

Beyond the source code Last week we have seen how to use Roslyn to rewrite source code to your liking. That’s all well and good, but it’s not the only thing you can do when you have a compiler open and ready to do your bidding. Another possibility is to leverage the knowledge that the […]

Getting started with Roslyn: transforming C# code

The code for this post is on GitHub: getting-started-roslyn Under the hood Making a programming language actually useful is not simply about designing it well but it is also about providing supporting tools around the language: compilers, obviously, but also editors, build systems, etc. There are few languages that give you tools to play under the […]