Post

How to Use ANTLR on .NET, Part I

This post is about how to use ANTLR on .NET.

This will be a series of several articles, as ANTLR 3 is really a complex system. Therefore, please be patience.

ANTLR 3 will be the focus of this series, as ANTLR 2 is too old.

Start from ANTLR on Java

ANTLR is an open source parser/compiler generator. By providing grammar files (.g) to it as input, it can output compiler source code in your preference (Java, C#, and so on). Its homepage is at http://www.antlr.org/.

You might take a look at the sample grammar files here, http://www.antlr.org/grammar/list. Don’t panic if you find the syntax hard to learn, as bit by bit you will get familiar with it.

OK. Though this series focus on how to use ANTLR 3 on .NET, please make sure you get familiar with how to use it on Java first (ANTLR is built on Java primarily). The best guide I found is the video clips here, http://javadude.com/articles/antlr3xtut/. The clips are hosted on Vimeo.

The rest of the series will assume you have watched the above clips and already familiar with ANTLR on Java. In part II I am going to introduce how to set up the environment.

Stay tuned.

© Lex Li. All rights reserved. The code included is licensed under CC BY 4.0 unless otherwise noted.
Advertisement