The Java Exorcist project's aim is to create a small and easy to use tool, that can be used to extend the Java language syntactically. Why would you do that? There are basically two reasons:
First, you just might want to fix your pet-peeve in the language itself. For example, create new keywords like 'unless', 'foreach', new operators, or generate setter getters automatically for a bean property.
Secondly, you might tune the language itself for a specific project, so the project code may look more clean and thought out. For example: specific logger keyword, which automatically checks (if statement) whether the logger should be invoked or not, or even ommits the whole logging compile-time, when it's disabled! Or create a method modifier 'transaction' to enclose the whole method in a project specific transaction.
How it works on the outside
Exorcist is a compiler of extended Java code. The compiler can be used in command-line mode, or through Ant. Basically, with no extensions configured, Exorcist only compiles the standard java code. To extend the language, you can plug in classes, which extend a single interface of the exorcist framework, and implement a single (and simple) method. That's it.
How it works inside
Exorcist works like a pre-processor. It translates the extended language into plain Java code, and then compiles it using the standard Java compiler (javac).
To analyze a language, there are two steps involved. The first is a Lexical analysis, the second is the Parsing of the lexical tokens. Lexical tokens are strings, numbers, operators, dots, semicolons, etc. These are also called terminal symbols, because they can not be analyzed further. During parsing, lexical tokens are read, and non-terminal symbols may be produced.
These include things like: expression, method body, declaration, if-statement, etc. The Exorcist's tranformation engine works basically with lexical token lists. Each extension first matches itself to the start of the received token list, using terminal and non-terminal symbols freely. If the match is detected, the extension is free to modify the input token list as it pleases, and with it modify the output clean Java source code.
What's New in This Release:
· Performance issues with built-in extensions were fixed.
· The "property" extension was fixed to handle other modifiers too.
· Annotations syntax was added to the grammar.