LLK Release 0.4

Release notes


This release has massive and incompatible changes. See detail change history here ....

Some highlights:

  • Lexer grammar now added context support.
  • Lexer grammar now support custom llkNextToken() rule.
  • Added sample grammars in llk-examples project and llk-csharp project.
  • CSharp grammar now support generics and, primitive support of parsing conditional sections into single AST model.
  • Updated Java grammar to support generics and other Java5 constructs.

Requirement to run

The current distribution is developed and tested with Java 1.5.0 and Linux. Since it is written completely in Java, it MAY work in other environment. These are packages required and being tested on. There are a number of support packages required that are bundled with the binary distribution:

Requirement to run generated parsers

Generated code should be self contained and require only Java JRE to run (unless user actions use other libraries, of course):

Requirement to compile

The current distribution is developed and tested only in Linux. Since it is written completely in Java, it may work in other environment. These are packages required and being tested on. There are a number of support packages required that are bundled with source in the source distribution: Also it is highly recommended that you have
  • Eclipse v3.1
  • black-sun plugins for Eclipse, which provide an LLK editor that support syntax highlighting and formatting, ... etc.

Installation and Running

Running the binary

LLK binary distribution include the ready to run binary llk.jar and required libraries. The main class (sf.llk.impl.LLKMain) should run without Eclipse provided the jar files to getopt , Jakarta-oro, blacksun-util packages are in the classpath. To run the binary, for example:
    java -classpath $(classpath) sf.llk.impl.LLKMain \
        -o src/a/parser -module a.parser \
        -sdir src/a/support -smodule a.support \

Compiling from the source

The package is developed and tested in Eclipse v3.1 GTK for Linux and Java 1.5.0. This release use the fireant build system from the black-sun project. The builders are located in the llk-fireant project.

The following directory structure is assumed:

where eclipse/ is the Eclipse installation. ext/ is the directory that contains the support libraries (eg. Jakarta-oro). llk/, ... etc are the project directories from the source distribution.

To build from the source:

  • Make sure you are running with Java1.5 and Eclipse 3.1.
  • Setup directory structure as above.
  • Unpack source distribution archive into the workspace and start Eclipse.
  • Make sure Java compliance level is set to Java 5.0 in Window/Prefereences/Java/Compiler/Compiler Compliance Level.
  • Import the llk and other projects with Import.../Existing project into Workspace
  • Refresh and rebuild all projects.
  • To install, invoke the fireant builder sf.llk.fireant.Builder Install target. That would create all the binary and source jar files in the ext/ directory. There are a number of ways to invoke the fireant builder inside Eclipse:
    • If you have the black-sun v0.7.0 plugins for Eclipse installed, you can invoke the builder with the Fireant menu item in the PackageView popup menu or from an editor (see the black-sun documentation for details on this).
    • If you do not have the black-sun plugins installed, the easiest way is to use Run As/Java Application ... menu item in the PackageView. Eclipse would create a Launch configuration for the builder with correct classpaths. Just enter the target Install as argument and launch the configuration would invoke the fireant builder to build the target.
    • Otherwise the fireant.sh script inside the llk-fireant project directory may works for you:
          bash ./fireant.sh Install

Rebuilding the LLK parser

The LLK parser is generated by LLK itself. To regenerate the lexer, parser and treeparsers from LLK.ll ... etc, a LLK binary is required (one is included in the binary distribution).
  • Make sure you setup the correct environment as described in Compiling the source distribution section above.
  • If you have the black-sun builder plugin installed (for Eclipse), any changes to LLK.ll or other grammar files would trigger the fireant incremental builder to rebuild of parsers.
  • Otherwise, in the llk-fireant project directory, run:
        bash ./fireant.sh BlacksunFireantBuild
    to rebuild any modified grammar or
        bash ./fireant.sh RebuildParsers
    to rebuild all the parsers.

Status and plans

The code is considered to be beta quality. It is usable for some real life work. However, it is by no means thoroughly tested.

There are a number of sample grammar projects, eg. llk-java5 for Java5, llk-gnuc for GnuC, llk-csharp for CSharp, llk-examples ... etc., in the source distribution. The sample grammars are developed and provided for testing purpose and may not be complete or updated.