ANTLR 3.2 Release Notes
ANTLR v3.2
September 22, 2009
Terence Parr
ANTLR project lead and supreme dictator for life
University of San Francisco
Credits
ANTLR v3.2 is a bug fix and feature release.
New features
- Added tree grammar filter=true mode. See Tree pattern matching
- 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.
Changes
- Added new options for tool invocation to control the points at which the code
generator tells the target code to use its equivalent of switch() instead of
inline ifs.-Xmaxswitchcaselabels m don't generate switch statements for dfas bigger than m [300] -Xminswitchalts m don't generate switch statements for dfas smaller than m [3]
- Upgraded -X help output to include new options and provide the default settings, as well as provide units for those settings that need them.
- .g and .g3 file extensions work again.
- introduced bug in 3.1.3: gives exception not error msg upon missing .g file
- CommonTreeNodeStream -> BufferedTreeNodeStream. Now,
CommonTreeNodeStream is completely unbuffered unless you are
backtracking. No longer making a list of all nodes before tree parsing.
Java Target
- Added reset to TreeNodeStream interface.
C Target
- Change the C Target to overide the deafults for the new settings to generate the most optimizable C code from the modern C compiler point of view. This is essentially to always use swtich statements unless there is absolutely no other option. C defaults are to use 1 for minimum and 3000 for maximum number of alts that trigger switch(). This results in object code that is 30% smaller and up to 20% faster.
From bug tracking system
Java target
- ANTLR-374 invalid % syntax problem; not handling valid template syntax