How does it work?
jGazm parses the given file or text input stream and creates a Java source file which is compiled at runtime and executed.
The created Java object inherits com.crazedout.jgazm.Lang and all code that is not jGazm annotated is placed inside a try/catch java.lang.Exception inside Lang.execute() method.
Command line arguments can be obtained from the global String[] ARGS. The flag -dump will print the created Java source to stdout.
Exampel of jGazm code:
jgazm -stdin
>out("Hello World");
>. // . on a single line executes...
Generated Java source.
import java.util.*;
import java.sql.*;
import com.crazedout.jgazm.*;
import java.net.*;
import java.lang.*;
import java.io.*;
import static java.util.Arrays.*;
/* Code auto generated by jGazm v.1.0*/
public class defaultjgazm1461509252663_java extends com.crazedout.jgazm.Lang {
/* main() arguments */
final String[] ARGS = new String[0];
public static void main(String argv[]) {
new defaultjgazm1461509252663_java().execute();
}
@Override
public void execute() {
try{
/* JAVA */
out("Hello World");
}catch(Exception ex){
onException(ex);
}
}
}
|