ponderToolkit.compiler
Class Compiler

java.lang.Object
  |
  +--ponderToolkit.compiler.Compiler

public class Compiler
extends java.lang.Object

Function: The main class for the Ponder Compiler. Compiles the Ponder Code and Generates Code. The Compiler contains a CodeAssembler which is responsible for the coordinating the code generation. It also allows the addition of code generators and of a policy (conflict) analyser.


Constructor Summary
Compiler()
          Default Constructor.
Compiler(java.io.PrintStream out)
          Constructor which accepts an Output stream to use as the output for compiler standard output messages
Compiler(java.io.PrintStream out, java.io.PrintStream err)
          Constructor which accepts a PrintStream to use as the output for compiler standard output messages, and a second PrintStream to be used for compiler error messages
 
Method Summary
 void addCodeGenerator(CodeGeneratorI newCodeGenerator, int codeGenType)
          add a new CodeGenerator
 void analyse(java.io.InputStream is, boolean applyPrRules, java.io.InputStream prioritiesIS)
          Analyse given ponder source code for conflicts after semantically analysing it
 void analyse(java.lang.String filename)
          Analyse given ponder source file after semantically analysing it
 void buildMessage(java.lang.String message)
          Build Message
 void compile(java.io.InputStream is)
          Compile given input stream connected to ponder source code
 void compile(java.lang.String filename)
          Compile given ponder source code file and generate code
 void compileMessage(java.lang.String message)
          Compile Message.
 void errorMessage(java.lang.String message)
          Error Message
 ponderToolkit.compiler.syntax.node.Start getAST()
          Return the Abstract Syntax Tree created by the Syntax Analyser (the SableCC AST).
 java.util.Hashtable getCodeGenerators()
          get the code Generators that are going to be used to generate code
 boolean getCodeStoreEnabled()
          Get the codeStore status of the compiler.
 java.lang.String getDestinationDirectory()
          Get the destination directory for the code generator.
 boolean getEnableWarnings()
          Returns true if warnings are enabled.
 java.lang.String getFilename()
          Get the destination directory for the code generator.
 boolean getOfflineCompile()
          Get the offline mode of the compiler.
 boolean getRuntimeCheckEnabled()
          Get the runtimeCheck status of the compiler.
 void infoMessage(java.lang.String message)
          Information Message
 void parse(java.io.InputStream is)
          Parse given input stream connected to ponder source code
 void parse(java.lang.String filename)
          Parse given ponder source code file
 void setAnalyzer(PolicyAnalyserI newAnalyser)
          set the policy analyser
 void setBuildStream(java.io.PrintStream newBuildStream)
          set the build stream for the compiler
 void setCode(java.lang.String codeText)
          Set the generated code
 void setCodeGenerators(java.util.Hashtable newCodeGenerators)
          set the code Generators that are going to be used to generate code
 void setCodeStoreEnabled(boolean newCodeStoreEnabled)
          Set the codeStore status of the compiler.
 void setCodeStream(java.io.PrintStream newCodeStream)
          Set the PrintStream thats going to be used to print the code
 void setDestinationDirectory(java.lang.String newDestDirectory)
          Set the destination directory for the code generator.
 void setEnableVerbose(boolean newEnableVerbose)
          Sets the verbose compile mode.
 void setEnableWarnings(boolean newEnableWarnings)
          Sets the warning-enable status of the compiler
 void setFilename(java.lang.String newFilename)
          Set the destination directory for the code generator.
 void setOfflineMode(boolean newOfflineCompile)
          Set the offline mode of the compiler.
 void setOutputStream(java.io.PrintStream out)
          set the output stream for the compiler
 void setRuntimeCheckEnabled(boolean newRuntimeCheckEnabled)
          Set the runtimeCheck status of the compiler.
 void systemMessage(java.lang.String message)
          System Message
 void warningMessage(java.lang.String message)
          Warning Message
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Compiler

public Compiler(java.io.PrintStream out,
                java.io.PrintStream err)
Constructor which accepts a PrintStream to use as the output for compiler standard output messages, and a second PrintStream to be used for compiler error messages

Compiler

public Compiler(java.io.PrintStream out)
Constructor which accepts an Output stream to use as the output for compiler standard output messages

Compiler

public Compiler()
Default Constructor. Default output streams are: System.out and System.err
Method Detail

setOutputStream

public void setOutputStream(java.io.PrintStream out)
set the output stream for the compiler

setBuildStream

public void setBuildStream(java.io.PrintStream newBuildStream)
set the build stream for the compiler

setEnableVerbose

public void setEnableVerbose(boolean newEnableVerbose)
Sets the verbose compile mode. True means On

setEnableWarnings

public void setEnableWarnings(boolean newEnableWarnings)
Sets the warning-enable status of the compiler

getEnableWarnings

public boolean getEnableWarnings()
Returns true if warnings are enabled. False otherwise

setOfflineMode

public void setOfflineMode(boolean newOfflineCompile)
Set the offline mode of the compiler.

getOfflineCompile

public boolean getOfflineCompile()
Get the offline mode of the compiler.

setDestinationDirectory

public void setDestinationDirectory(java.lang.String newDestDirectory)
Set the destination directory for the code generator.

getDestinationDirectory

public java.lang.String getDestinationDirectory()
Get the destination directory for the code generator.

setFilename

public void setFilename(java.lang.String newFilename)
Set the destination directory for the code generator.

getFilename

public java.lang.String getFilename()
Get the destination directory for the code generator.

setRuntimeCheckEnabled

public void setRuntimeCheckEnabled(boolean newRuntimeCheckEnabled)
Set the runtimeCheck status of the compiler.

getRuntimeCheckEnabled

public boolean getRuntimeCheckEnabled()
Get the runtimeCheck status of the compiler.

setCodeStoreEnabled

public void setCodeStoreEnabled(boolean newCodeStoreEnabled)
Set the codeStore status of the compiler.

getCodeStoreEnabled

public boolean getCodeStoreEnabled()
Get the codeStore status of the compiler.

setCodeGenerators

public void setCodeGenerators(java.util.Hashtable newCodeGenerators)
set the code Generators that are going to be used to generate code

getCodeGenerators

public java.util.Hashtable getCodeGenerators()
get the code Generators that are going to be used to generate code

addCodeGenerator

public void addCodeGenerator(CodeGeneratorI newCodeGenerator,
                             int codeGenType)
add a new CodeGenerator

setAnalyzer

public void setAnalyzer(PolicyAnalyserI newAnalyser)
set the policy analyser

infoMessage

public void infoMessage(java.lang.String message)
Information Message

warningMessage

public void warningMessage(java.lang.String message)
Warning Message

errorMessage

public void errorMessage(java.lang.String message)
Error Message

systemMessage

public void systemMessage(java.lang.String message)
System Message

buildMessage

public void buildMessage(java.lang.String message)
Build Message

compileMessage

public void compileMessage(java.lang.String message)
Compile Message. A detailed message during the compilation

parse

public void parse(java.lang.String filename)
Parse given ponder source code file

parse

public void parse(java.io.InputStream is)
Parse given input stream connected to ponder source code

compile

public void compile(java.lang.String filename)
Compile given ponder source code file and generate code

compile

public void compile(java.io.InputStream is)
Compile given input stream connected to ponder source code

analyse

public void analyse(java.io.InputStream is,
                    boolean applyPrRules,
                    java.io.InputStream prioritiesIS)
Analyse given ponder source code for conflicts after semantically analysing it

analyse

public void analyse(java.lang.String filename)
Analyse given ponder source file after semantically analysing it

getAST

public ponderToolkit.compiler.syntax.node.Start getAST()
Return the Abstract Syntax Tree created by the Syntax Analyser (the SableCC AST).

setCodeStream

public void setCodeStream(java.io.PrintStream newCodeStream)
Set the PrintStream thats going to be used to print the code

setCode

public void setCode(java.lang.String codeText)
Set the generated code