|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcodesimian.CS
codesimian.DefaultCS
codesimian.Compile
public abstract class Compile
Contains inner subclasses for compiling CodeSimian language.
There can be many types of COMPILERs, but they all share this...
% 2 <= minP()
% param0's param(s) are the compiled output. 1 <= param0.countP().
% param1's param(s) are the input objects.
They can be interpreted as their literal char values (in a string of code),
a sequence of CS objects, or anything you want.
% DForProxy() returns a positive value if compiled ok, else a negative value or 0.
% if DForProxy() returns 0 or negative, param0 is interpreted as
a string error message (or other type of CS describing an error).
Multiple COMPILERS at once are usually executed
as a pipeline - the output of one is the input to the next.
It could be a lexer followed by a parser, but the standard CodeSimian compiler
uses 3 compilers: TokenizeCode, TokensToObjects, and ParseObjects.
You dont have to use that simple default compiler.
Example: You could make a very complex compiler
that takes other compilers as input and outputs new compilers.
This is a SimpleCompiler as CodeSimian code:
compilerPipeline( 0 '+(2 3)' tokenizeCode(0 0) tokensToObjects(0 0) parseObjects(0 0) )
...becomes...
compilerPipeline(
     +(2 3)
     '+(2 3)'
     tokenizeCode( list('+' '(' '2' '3' ')') '+(2 3)' )
     tokensToObjects( list(+ LPARAN 2 3 RPARAN) list('+' '(' '2' '3' ')') )
     parseObjects( +(2 3) list(+ LPARAN 2 3 RPARAN) )
)
| Nested Class Summary | |
|---|---|
static class |
Compile.CompilerPipeline
A pipeline/sequence of COMPILERs. |
static class |
Compile.LParenSymbol
|
static class |
Compile.MyFuelSymbol
|
static class |
Compile.NameSymbol
|
static class |
Compile.ParseObjects
Converts a sequence (that often has duplicate objects) of CS objects (that probably do not have enough params) to a tree or graph-shape of CS objects, where each CS object has a valid quantity of params, assuming your parenthesis (example: Compile.LPAREN) allow that. |
static class |
Compile.ParseObjectsByPriority
Infix-syntax for CodeSimian language. |
static class |
Compile.RParenSymbol
|
static class |
Compile.SimpleCompiler
wrapper-class for a standard CompilerPipeline made of 3 smaller compilers |
static class |
Compile.SmallSymbol
a symbol that uses very little memory and has only 1 variable (a byte) specifying how many semicolons that precede the symbol. |
static class |
Compile.Symbol
Deprecated. |
static class |
Compile.TokenizeCode
Converts a STRING of CodeSimian code to a list of STRINGs - tokens of code. |
static class |
Compile.TokensToObjects
Converts a sequence of string tokens to a sequence of CS objects with no params. |
static class |
Compile.WhitespaceSymbol
|
| Field Summary | |
|---|---|
static CS |
LPAREN
4/06 OBSOLETE JAVADOC, BUT STILL A LITTLE USEFUL... LPAREN and RPAREN should be part of output of Lex and part of input to Parse if you use paranthesis. |
static CS |
MYFUEL
a TOKEN preceding an integer specifying the myFuel() for some CS being compiled, like +#fifteen$5(3 fifteen) which becomes +#fifteen$0(3 fifteen) after increasing its value to 15 by 3s. Or it could be simpler: ask$3("I refuse to ask this more than 3 times" OK) |
static CS |
NAME
a TOKEN representing spaces, tabs, and possibly newlines. |
static CS |
RPAREN
|
static CS |
TEMPORARY_PARAM
Put Compile.TEMPORARY_PARAM in the params of newly instantiated CSs so they do not have an error caused by calling functions while countP() < minP(). |
static CS |
WHITESPACE
a TOKEN representing spaces, tabs, and possibly newlines. |
| Fields inherited from class codesimian.CS |
|---|
DESCRIPTION, END, EXECPROXY, FUEL, HEAP, JAVACODE, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER |
| Constructor Summary | |
|---|---|
Compile()
|
|
| Method Summary | |
|---|---|
double |
cost()
cost() should be changed to return a float, and should be renamed to costToExecute() cost of EXECUTING this CS, not including any CSs it executes recursively. |
java.lang.Class |
javaCompile(java.lang.String javaCodeFor1Class)
compiles java code and returns the Class it compiles. |
static java.util.jar.JarInputStream |
javaCompile(java.util.zip.ZipInputStream jarOrZipFile)
compiles the .java files inside a ZIP file (all JAR files are ZIP files) and outputs a JAR file (as a JarInputStream) containing all files in the ZIP plus many .class files generated from the .java files in the ZIP. |
int |
minP()
For DForProxy(). Minimum number of parameters in param[] needed to call DForProxy(). Defines which indexs of param[] DForProxy() can use. Functions with a different number of parameters must override this. OVERRIDE THIS FUNCTION IF EXEC USES A DIFFERENT NUMBER OF PARAMETERS. Default is 1. |
| Methods inherited from class codesimian.DefaultCS |
|---|
B, C, countP, decrementMyFuel, deleteP, description, DForProxy, F, fuel, getExec, getObject, heap, I, indexP, indexPName, insertB, insertC, insertD, insertF, insertI, insertJ, insertL, insertL, insertL1, insertP, insertS, insertZ, J, javaCode, keyword, LForProxy, LForProxy, myFuel, name, newInstance, objectToCS, objectToCSArray, objectToCSArray, P, prevD, prevL, PType, S, setB, setC, setCountP, setD, setD, setExec, setF, setFuel, setI, setJ, setL, setL, setL, setL1, setMyFuel, setName, setObject, setP, setPrevExec, setS, setZ, start, toString, V, Z |
| Methods inherited from class codesimian.CS |
|---|
addP, addP, addP, addP, addP, BForProxy, CForProxy, clone, D, deleteP, FForProxy, IForProxy, isIllusion, javaCode, JForProxy, L, L, L, L, L, maxD, maxP, minD, overwrites, parent, parsePriority, PB, PC, PD, PF, PI, PJ, PL, prevB, prevC, prevF, prevI, prevJ, prevS, prevZ, proxyOf, PS, PZ, reflect, reflect, setB, setC, setCost, setDescription, setF, setHeap, setI, setJ, setL, setL, setParent, setParsePriority, setProxyOf, setPType, setS, setTester, setZ, SForProxy, tester, VForProxy, voidReflect, ZForProxy |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final CS LPAREN
RPARENpublic static final CS RPAREN
LPARENpublic static final CS NAME
public static final CS MYFUEL
public static final CS WHITESPACE
public static final CS TEMPORARY_PARAM
TEMPORARY_PARAM| Constructor Detail |
|---|
public Compile()
| Method Detail |
|---|
public int minP()
DefaultCS
minP in class DefaultCSpublic double cost()
CS
cost in class CSpublic static java.util.jar.JarInputStream javaCompile(java.util.zip.ZipInputStream jarOrZipFile)
public java.lang.Class javaCompile(java.lang.String javaCodeFor1Class)
throws java.lang.Throwable
java.lang.Throwable
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||