| java.lang.Object fri.patterns.interpreter.parsergenerator.builder.CompiledTables
CompiledTables | public class CompiledTables (Code) | | 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");
|
Constructor Summary | |
public | CompiledTables() Creates a parser tables factory that uses compiled tables as buffer. | public | CompiledTables(boolean development) Creates a parser tables factory that uses compiled tables as buffer. |
Method Summary | |
protected int | compile(String javaFile) Aufruf des Sun-Compilers. | public AbstractParserTables | get(Object syntaxInput) 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. | public AbstractParserTables | get(Object syntaxInput, String className) 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. Parameters: className - name of target class of ParserTables, without package path, without .java extension. | public AbstractParserTables | get(Class parserType, Object syntaxInput, String className) 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. Parameters: className - name of target class of ParserTables, without package path, without .java extension. Parameters: parserType - class of ParserTables to create, e.g. | public static void | main(String[] args) Test main. |
CLASSFILE_SUFFIX | final public static String CLASSFILE_SUFFIX(Code) | | The suffix for compiled ParserTables files.
|
CompiledTables | public CompiledTables()(Code) | | Creates a parser tables factory that uses compiled tables as buffer.
|
CompiledTables | public CompiledTables(boolean development)(Code) | | Creates a parser tables factory that uses compiled tables as buffer. @param development when true tables will NOT be compiled.
|
compile | protected int compile(String javaFile)(Code) | | Aufruf des Sun-Compilers. Dazu muss tools.jar im CLASSPATH sein!
return-code von "new com.sun.tools.javac.Main().compile(javaFile)". |
get | public AbstractParserTables get(Object syntaxInput) throws Exception(Code) | | 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. ParserTables object, or object built from scratch that gets compiled into current directory. |
get | public AbstractParserTables get(Object syntaxInput, String className) throws Exception(Code) | | 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. Parameters: className - name of target class of ParserTables, without package path, without .java extension. ParserTables object, or object built from scratch that gets compiled into current directory. |
get | public AbstractParserTables get(Class parserType, Object syntaxInput, String className) throws Exception(Code) | | 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. Parameters: className - name of target class of ParserTables, without package path, without .java extension. Parameters: parserType - class of ParserTables to create, e.g. LALRParserTables.class ParserTables object, or object built from scratch that gets compiled into current directory. |
main | public static void main(String[] args)(Code) | | Test main. Building compiled ParserTables takes 1600, building from scratch takes 6000 millis.
|
|
|