fri.patterns.interpreter.parsergenerator.builder
Class CompiledTables

java.lang.Object
  |
  +--fri.patterns.interpreter.parsergenerator.builder.CompiledTables

Deprecated. in favor of serialization

public class CompiledTables
extends java.lang.Object

This class is deprecated in favor of serialization.

CompiledTables buffers parser tables by generating source and compiling that source. This lasts very long at first time, but is faster than serialization for every subsequent call. The class will be posted in current directory (has no package). The source gets removed after successful compilation. The Sun compiler must be in package path, which is normally in $JAVA_HOME/lib/tools.jar.

Building compiled Java ParserTables takes 1600, building from scratch takes 6000 millis. CompiledTables seem to be slower than SerializedParser!

An alternative to compiled tables is generating the parser tables source with SourceGenerator and integrating that source into project sources. This avoids the dynamically created class in working directory and the neccessity to have javac in CLASSPATH at runtime.

                ParserTables tables = new CompiledTables().get(syntaxInput, "MyParserTables");
        


Field Summary
static java.lang.String CLASSFILE_SUFFIX
          Deprecated. The suffix for compiled ParserTables files.
 
Constructor Summary
CompiledTables()
          Deprecated. Creates a parser tables factory that uses compiled tables as buffer.
CompiledTables(boolean development)
          Deprecated. Creates a parser tables factory that uses compiled tables as buffer.
 
Method Summary
protected  int compile(java.lang.String javaFile)
          Deprecated. Aufruf des Sun-Compilers.
 AbstractParserTables get(java.lang.Class parserType, java.lang.Object syntaxInput, java.lang.String className)
          Deprecated. Builds the ParserTables from scratch if not found as class in CLASSPATH, else loads that class.
 AbstractParserTables get(java.lang.Object syntaxInput)
          Deprecated. Builds the ParserTables from scratch if not found as class in CLASSPATH, else loads that class.
 AbstractParserTables get(java.lang.Object syntaxInput, java.lang.String className)
          Deprecated. Builds the ParserTables from scratch if not found as class in CLASSPATH, else loads that class.
static void main(java.lang.String[] args)
          Deprecated. Test main.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASSFILE_SUFFIX

public static final java.lang.String CLASSFILE_SUFFIX
Deprecated. 
The suffix for compiled ParserTables files.

See Also:
Constant Field Values
Constructor Detail

CompiledTables

public CompiledTables()
Deprecated. 
Creates a parser tables factory that uses compiled tables as buffer.


CompiledTables

public CompiledTables(boolean development)
Deprecated. 
Creates a parser tables factory that uses compiled tables as buffer. @param development when true tables will NOT be compiled.

Method Detail

get

public AbstractParserTables get(java.lang.Object syntaxInput)
                         throws java.lang.Exception
Deprecated. 
Builds the ParserTables from scratch if not found as class in CLASSPATH, else loads that class. LALRParserTables.class wil be the type of created parser tables.

Parameters:
syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
Returns:
ParserTables object, or object built from scratch that gets compiled into current directory.
java.lang.Exception

get

public AbstractParserTables get(java.lang.Object syntaxInput,
                                java.lang.String className)
                         throws java.lang.Exception
Deprecated. 
Builds the ParserTables from scratch if not found as class in CLASSPATH, else loads that class. LALRParserTables.class wil be the type of created parser tables.

Parameters:
syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
className - name of target class of ParserTables, without package path, without .java extension.
Returns:
ParserTables object, or object built from scratch that gets compiled into current directory.
java.lang.Exception

get

public AbstractParserTables get(java.lang.Class parserType,
                                java.lang.Object syntaxInput,
                                java.lang.String className)
                         throws java.lang.Exception
Deprecated. 
Builds the ParserTables from scratch if not found as class in CLASSPATH, else loads that class. LALRParserTables.class wil be the type of created parser tables.

Parameters:
syntaxInput - the Parser syntax as File, InputStream, List of Lists, String [][] or Syntax.
className - name of target class of ParserTables, without package path, without .java extension.
parserType - class of ParserTables to create, e.g. LALRParserTables.class
Returns:
ParserTables object, or object built from scratch that gets compiled into current directory.
java.lang.Exception

compile

protected int compile(java.lang.String javaFile)
Deprecated. 
Aufruf des Sun-Compilers. Dazu muss tools.jar im CLASSPATH sein!

Returns:
return-code von "new com.sun.tools.javac.Main().compile(javaFile)".

main

public static void main(java.lang.String[] args)
Deprecated. 
Test main. Building compiled ParserTables takes 1600, building from scratch takes 6000 millis.