ANTLR 3.1.3 Release Notes

ANTLR v3.1.3

March 17, 2009

Terence Parr
ANTLR project lead and supreme dictator for life
University of San Francisco

ANTLR v3.1.3 is a bug fix release.


  • Added associativity token option to support upcoming special expression parsing. Added rule option strategy=precedence also. For future use.
  • ANTLR always sorts incoming grammar list by dependency. For example, if W.g depends on tokens from P.g then P.g is done first even if W.g mentioned first on command line. It does not ignore any files you specify the commandline. If you do *.g and that includes some imported grammars, it will run antlr on them.
  • -make option prevents ANTLR from running on P.g if P older than generated files.
  • Added org.antlr.tool.GrammarSpelunker to build a faster dependency checker (what grammars depend on etc...). Totally independent of any ANTLR code; easy to pull into other tools.
  • Added org.antlr.misc.Graph, a general graph with nodes containing an Object payload. It knows how to do a topological sort on the nodes.
  • Changed ANTLRWorks debug port in runtime support code from 49153 to 49100. Apparently we changed the port in ANTLRWorks to 49100 in v1.2 but forgot to do so in the ANTLR targets.
  • Added misc.FastQueue and TestFastQueue: A queue that can dequeue and get(i) in O(1) and grow arbitrarily large. A linked list is fast at dequeue but slow at get(i). An array is the reverse. This is O(1) for both operations.
  • Added tree.TreeIterator, a generator that walks a doubly linked tree. The nodes must know what index they are. It's an Iterator but remove() is not supported. Returns navigation nodes always: UP, DOWN, EOF.
  • Added misc.LookaheadStream: A lookahead queue that knows how to mark/release locations in the buffer for backtracking purposes. I hope to use for both tree nodes and tokens. Just implement nextElement() to say how to get next node or token.

From bug tracking system

C target

  • Reinstated setInputStream() method call for token factories, as it is needed in certain instances such as the PUSHSTREAM() POPSTREAM() macros.
  • C Parser example updated for 3.1.2+ to show how to handle the fact that scope memory is not automatically memset to 0 and how to be more efficient when allocating things in a scope (delayed allocations)

C# target

Fixed several template bugs:

  • "+=" for lexer rules didn't work because a variable was not defined
  • Missing conversions caused compile errors
  • Debug mode for grammars was broken at several places
  • Moved usings declarations in front of namespace declaration to allow compilation of more pathological cases

Runtime changes:

  • Default debugging port is now conform to ANTLRworks

Java target

Python target

ActionScript target

  • Small tweaks to code generation. You must update to the latest runtime library when linking against code generated in this version.
  • Added org.antlr.runtime.version String constant that indicates the version number of the runtime library. Currently set to "3.1.3".