Package org.allspice.compiler

Examples of org.allspice.compiler.Compiler


   * Compile ourselves and print it out.
   * @throws Exception
   */
  public static void javac() throws Exception {
    // Get the compiler
    Compiler compiler = JavaCompilerCompiler.loadJavaCompiler();
    // Parse the file
    FileUnit fu = compiler.parse(new JavaTokenizer(new StringReader(source))) ;

    // Create a class with the parsed HelloWorld.
    ClassConverter.writeClassFiles(StdJavaExpressions.INSTANCE,new File(System.getProperty("java.io.tmpdir")),new FIFO<FileUnit>(fu)) ;
  }
View Full Code Here


   * @return The object gotten from compiling the expression and running it.
   * @throws Exception
   */
  public static Object javac(String line) throws Exception {
    // Get the compiler
    Compiler compiler = JavaCompilerCompiler.loadJavaCompiler();
    // Parse the file
    FileUnit fu = compiler.parse(new JavaTokenizer(new StringReader(String.format(source,line)))) ;

    // Create a class loader with the parsed ExprEval.
    ClassLoader loader = ClassConverter.createLoader(StdJavaExpressions.INSTANCE,new FIFO<FileUnit>(fu)) ;
    // invoke expr.
    Method m = loader.loadClass("ExprEval").getMethod("expr") ;
View Full Code Here

TOP

Related Classes of org.allspice.compiler.Compiler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.