Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

developerWorks Community:

  • Close [x]

Building custom language parsers

Solving common parsing problems with ANTLR

Arpan Sen (, Lead Engineer, Synapti Computer Aided Design Pvt Ltd
Arpan Sen is a lead engineer working on the development of software in the electronic design automation industry. He has worked on several flavors of UNIX, including Solaris, SunOS, HP-UX, and IRIX as well as Linux and Microsoft Windows for several years. He takes a keen interest in software performance-optimization techniques, graph theory, and parallel computing. Arpan holds a post-graduate degree in software systems. You can reach him at
(An IBM developerWorks Contributing Author)

Summary:  There are certain things about ANTLR that, if understood, help in faster debugging and provide a fuller appreciation of how the tool works. Learn how to use ANTLR to create smarter parsing solutions.

Date:  11 Mar 2008
Level:  Intermediate PDF:  A4 and Letter (86 KB)Get Adobe® Reader®

Activity:  17525 views

Before you start

Learn what to expect from this tutorial and how to get the most out of it.

About this tutorial

If you're in the business of developing a parser or compiler (considered by most a somewhat black art, indeed), there are several technical issues you must address. In recent times, ANother Tool for Language Recognition (ANTLR) has been gaining a lot of traction as the tool of choice for creating language parsers. This tutorial takes a close look at some of the typical issues you would encounter while creating a custom parser and shows how to solve those problems using ANTLR.


In this tutorial, you learn how to create custom language parsing with the help of ANTLR. In addition, you learn how to address common issues that arise with compiler and parser creation.


To fully appreciate this tutorial, you must have some familiarity with both language parsing and with ANTLR. All code in this tutorial has been tested with ANTLR version 2.7.2 and compiled with the GNU Compiler Collection (GCC) version 3.4.4.

System requirements

To run the examples in this tutorial, you need the following elements:

1 of 10 | Next


Zone=AIX and UNIX
TutorialTitle=Building custom language parsers