Tutorials and issues on all aspects of creating software to analyse code

ANTLR Mega Tutorial

The ANTLR Mega Tutorial

Parsers are powerful tools, and using ANTLR you could write all sort of parsers, usable from many different languages. In this complete tutorial we are going to: explain the basics: what a parser is, what it can be used for see how to setup ANTLR to be used from Javascript, Python, Java and C# discuss […]

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 […]

Building and testing a parser with ANTLR and Kotlin

Building and testing a parser with ANTLR and Kotlin

This post is the part of a series. The goal of the series is to describe how to create a useful language and all the supporting tools. Building a lexer Building a parser Creating an editor with syntax highlighting Build an editor with autocompletion Mapping the parse tree to the abstract syntax tree Model to model […]

Getting started with ANTLR: building a simple expression language

Getting started with ANTLR: building a simple expression language

This post is the part of a series. The goal of the series is to describe how to create a useful language and all the supporting tools. Building a lexer Building a parser Creating an editor with syntax highlighting Build an editor with autocompletion Mapping the parse tree to the abstract syntax tree Model to model […]

On the need of a generic library around ANTLR_ using reflection to build a metamodel

On the need of a generic library around ANTLR: using reflection to build a metamodel

I am a Language Engineer: I use several tools to define and process languages. Among other tools I use ANTLR: it is simple, it is flexible, I can build things around it. However I find myself rebuilding similar tools around ANTLR for different projects. I see two problems with that: ANTLR is a very good […]

ANTLR and Jetbrains MPS: Parsing files and display the AST using the tree notation

Itemis did it again: they just released a new very cool plugin for Jetbrains MPS. This one permits to define new tree editors. They look like this: In this post we are going to see: how to use ANTLR parsers inside MPS how to represent the parsed AST using the tree notation In particular we are […]

Parsing any language in 5 minutes

Parsing Any Language in Java in 5 Minutes Using ANTLR: for Example Python

I like processing code for several purposes, like static analysis or automated refactoring. The interesting part to me is to reason on the models you build from the Abstract Syntax Tree (AST). To get there you need a way to get the AST from your source files. This can be done easily using ANTLR and the […]

Turin Programming Language for the JVM: building advanced lexers with ANTLR

Turin Programming Language for the JVM: Building Advanced Lexers with ANTLR

As I wrote in my last post, I recently started working on a new programming language named Turin. A working compiler for an initial version of the language is available on GitHub. I am currently improving the language and working on a Maven and an IntelliJ plugins. Here and in the next posts I will go over the […]

Develop DSLs for Eclipse and IntelliJ using Xtext

Develop DSLs for Eclipse and IntelliJ Using Xtext

In this post we are going to see how to develop a simple language. We will aim to get: a parser for the language an editor for IntelliJ. The editor should have syntax highlighting, validation and auto-completion We would also get for free an editor for Eclipse and web editor, but please contain your excitement, we […]

Do You Need a Parser?

We can design parsers for new languages, or rewrite parsers for existing languages built in house.

On top of parsers we can then help building interpreters, compilers, code generators, documentation generators, or translators (code converters) to other languages.