Wednesday, March 21, 2007

Developing our own Language Parsers and Compilers

Most of the software developers one day or other come in their work life come across a situation where they need to parse and evaluate expression of their own language and syntax. Defining our own language is very common requirement when we develop an application which is going to allow users to script through the application interface and interact with some components. We define our languages and grammar instead of re-using existing languages as the new languages may be too much or too little for our requirements. Now I’m working on a new language definition which allows users to write mathematical expressions, string expressions, using predefined functions, if-else constructs. We are developing a small parser which validates the syntax of the input script and evaluates the expression. The following are the interesting articles which helped in designing and developing my own language with a decently working parser. Hope these articles may be useful to you.

  1. Let's Build a Compiler, by Jack Crenshaw
  2. Postfix Notation Mini-Lecture
  3. Parsing a Simple Expression Language
  4. Polymorphic Type Inference for Simple Expressions