[wglass@forio.com -- July 1, 2003]

I just learned how to modify the core language syntax recently. Here's a quick set of steps. This might serve as a basic "how-to" for new Velocity developers.

You'll need to download JavaCC from this link http://javacc.dev.java.net/

  1. Modify "Parser.jjt" to change the syntax of the language
  2. Use jjtree (part of javacc) to compile to Parser.jj. This will also generate a lot of "Node" java files which you should delete
  3. Use javacc to compile "Parser.jj" to "Parser.java".
  4. Edit the Node java files in the Nodes subdirectory to change evaluated behavior.
  5. Compile, build the jar as usual

JJTree is a pre-processor that generates java code which stores a tree of parsed syntax. All the Node files in the Nodes subdirectory were once generated by JJTree, but have since been modified and moved into the Node directory (to prevent them from being overwritten in step 2). If you extend the language and create a new syntactical expression which requires a new node, you should copy that generated Node file into the Nodes subdirectory.

RevisingSyntax (last edited 2009-09-20 23:33:20 by localhost)