| Projection, where the machine of the media uses light and shadow to transmit the message. |
When designing and writing software, one way of making your software more flexible is to embed a programming language in it. Imagine a product where privileged users could enter scripts to implement new or temporary business rules right in the application itself. One of the best ways I know to do that is to use a technology called antlr.
Short for ANother Tool for Language Recognition, antlr is a parser generator. It takes a grammer specification and builds the source code for a program that will parse any input written to that specification. The web site for this open source tool is http://www.antlr.org
Antlr is a LALR(k) parser. That means look ahead left to right k tokens deep. I like LALR because the disambiguading part of each production rule comes at the end and the payload comes at the beginning. That makes more sense to me when writing the production rules for the grammer specification.
Antlr is the product of Terence Parr. I used to teach at the same university where he teaches now. I never met him but I have a lot of respect for his work. I also have a lot of respect for USF which is a great school. I have used antlr in the past for command line utilities and conversion programs.
The only other good open source parser generators that I know about are yacc and bison. Yacc is an LR parser which is not as good as antlr or bison. Both yacc and bison are useful only for programs written in the C programming language. Antlr can be used by CPP, C#, Python, and Java code. Yacc is Unix software and Bison can only be run on Linux machines.
Antlr comes in two parts, the first part generates code from the grammer specification and the second part is a software library that the generated code depends on. The first part of Antlr can be run on any machine that has a modern Java runtime. The second part requires the runtime environment of the target development language. I have used Antlr on both Linux and Windows machines.
With antlr there are lots of choices of what to do with the parsed input. It can return an object hierarchy known as an Abstract Symbol Tree to be examined by your code. You can also embed your code in the grammer rules. I prefer the latter. The appropriate code gets executed when each grammer rule gets parsed. It can be a little confusing as to the order that the grammer rules are satisfied. Overall, development with antlr is much simpler than writing your own parser.