Skip to main content


developerWorks  >  AIX and UNIX  >

Building custom language parsers

Solving common parsing problems with ANTLR

developerWorks

Level: Intermediate

Arpan Sen (arpan@syncad.com), Lead Engineer, Synapti Computer Aided Design Pvt Ltd

11 Mar 2008

Register now or sign in using your IBM ID and password.

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.

In this tutorial

  • Getting the facts about ANTLR

  • Processing include files
    • Include file processing
    • Strategies for handling the INCLUDE directive

  • Compilers
    • Compiler fundamentals
    • Understand the code

  • Optimizing your include file processing
    • Performance optimization
    • Proper parser functioning
    • Modify the main routine

  • Error handling
    • Recover from errors in user code
    • Manipulate the exception class hierarchy

  • Common lexer classes
    • Exceptions for rogue or unexpected characters
    • Why bother with the exceptions?


Objectives

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.

Prerequisites

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:



Duration

2 hours


Formats

html, pdf


Share this....

digg Digg this story del.icio.us del.icio.us Slashdot Slashdot it!


Back to top


Document options

Document options requiring JavaScript are not displayed