LLK Release 0.3

Change history

Changes since v0.2

LLK
  • NEW - Action only alternative - () and ()+ block now accept an action only alternative as an error action. If none of the alternatives matched, the error action is executed in place of throwing a noViableAlternative exception. The error action should call llkError() to throw a LLKParseException with meaningful error message.
  • If an action only alternative is specified inside an ()? or ()* block, the action would be executed if there is zero occurence matched. See here for more details.
  • NEW - Labels now accept ':' operator which works like assignment ('=') but it automatically declare the label (as in ANTLR) in the method scope. Label can be used at multiple places as long as the expected type is compatible. LLK also init. the generated variable for the label with a default value (null for Object, false or 0 for primitive types).
  • NEW - Generated file header now show the file generation time.
  • NEW - LLKMain now has -idir and -imodule options to put most interfaces and utility classes in seperate packages so that they are more easily shared.
  • NEW - Added sf.llk.graph package that generate node graph from a treeparser grammar.
  • CHANGE - LLK packages are renamed to sf.llk.
  • CHANGE - Renamed LLKTokenStreamError to LLKParseError for more general use.
  • CHANGE - LLKToken now implements ISourceLocation and its location information fields are now protected and required to be accessed through access methods.
  • CHANGE - All keyword contexts are default to be disabled instead of enabled on startup or reset.
  • CHANGE - Most operations now go through interfaces (ILLKToken, ILLKNode, ISourceLocation, ILLKLexerInput, ILLKParserInput ... etc) instead of using the concrete classes directly. It is about 10% slower.
  • CHANGE - LLKTreeParserInput no longer require an ILLKParser as input, only an optional ISourceLocator is required for mapping error locations.
  • CHANGE - All error reporting take Throwable instead of Exception. Also ILLKMain.warn(String, int, int, int) and ILLKMain.error(String, int, int, int) is replaced by ILLKMain.warn(String, Throwable, int, int, int) and ILLKMain.error(String, Throwable, int, int, int).
  • CHANGE - ILLKLexerInput now has setFilename() and LLKLexer constructor now automatically call ILLKLexerInput.setFilename() to initialized filename from llkMain.
  • FIXED - ISourceLocator is now maintained by ILexerInput instead of by ILLKLexer so that error reported by ILexerInput can goes through ILocator.
  • FIXED - Token type now use node name with node prefix (instead of without node prefix) as token type name.
  • FIXED - _createTokenWithText() ... etc. that had incorrectly used length instead of end offset for calls to ILexerInput.getSource(int start, int end).
  • FIXED - LLKParser.skipMatchPair() now report the error (start) location if there is mismatch.
  • FIXED - llkConsumeUnit() methods now consume at least one token.
  • FIXED - Generated execption catch block now use _e instead of e as name of exception parameter to avoid name conflict with user code.
  • FIXED - Generated execption catch block now use _e instead of e as name of exception parameter to avoid name conflict with user code.
  • FIXED - Redirect all access to input source buffer to llkLexerInput.getSource(int start, int end). Removed field char[] llkSource from Lexer and Parser.
  • FIXED - ResetHook options support for lexer, parser and treeparser. When ResetHook==true, would be called llkInit() on parser creation and reset.
LLK treeparser generator
  • FIXED - Generator1.ll Choices() should return the max. depth instead of the min. depth if individual Choice return different depth.
  • FIXED - Generator1.ll mergeElement() should left (a()) (a())+ unchanged instead of merge to (a())+.
  • FIXED - Generator1.ll pullupOptionalChoice() should transform (a()*|...) to (a()+|...)? and (a()*|...)+ to (a()+|...)*.
  • FIXED - Generator1.ll now use current rule name instead of node name to generate name for the synthesized rule of element nodes.