|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcodesimian.CS<CSGeneric>
codesimian.DefaultCS
codesimian.Compile
public abstract class Compile
NEED TO MODIFY COMPILER SO THAT A STRING LITERAL CAN BE A NAME, LIKE THIS:
if#"the if"(ask("repeat this question?") "the if")
IT WOULD BE MORE POWERFUL IF THE STRING LITERAL NAME COULD BE A REGULAR EXPRESSION
AUTOMATICALLY IF IT CONTAINS CERTAIN CHARACTERS NORMALLY FOUND IN REGULAR EXPRESSIONS, LIKE THIS:
if#"(the if)* and this are part of the name"(slidebar the if the if and this too are part of the name)
BUT ITS PROBABLY BETTER TO MERGE CODESIMIAN WITH A JAVA VERSION OF PERL THAN TO IMPLEMENT THAT.
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.CompileDefaultCommand
wraps CSFactory. |
static class |
Compile.CompileLiteral
for example, input "-2.4" into P(1) and it outputs new N(-2.4) into P(0). |
static class |
Compile.CompilerPipeline
A pipeline/sequence of COMPILERs. |
static class |
Compile.FirstCompilerThatWorks
Contains compilers at index 2 and above. |
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
Deprecated. $MYFUEL should be removed from CodeSimian syntax. |
static CS |
NAME
the string symbol preceding a name declaration. |
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, HEAP, JAVACODE, NEWINSTANCE, NULL, PARENT, PARSEPRIORITY, PREV, TESTER, THIS |
| 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 byte[] |
javaCompileSelf()
|
static void |
javaCompileSelfSaveJar(java.lang.String pathNameOfJar)
|
static byte[] |
javaCompileZipBytes(byte[] jarOrZipFileBytes)
Input bytes of ZIP file, to be compiled. |
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, setPType, setS, setZ, start, toString, V, Z |
| Methods inherited from class codesimian.CS |
|---|
addB, addC, addD, addF, addI, addJ, addL, addP, addP, addP, addP, addP, addS, addZ, BForProxy, CForProxy, clone, D, deleteP, FForProxy, GETB, GETC, GETD, GETF, GETI, GETJ, GETL, GETS, GETZ, IForProxy, isIllusion, 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, reflect6, setB, SETB, setC, SETC, setCost, SETD, setDescription, setF, SETF, setHeap, setI, SETI, setJ, SETJ, SETL, setL, setL, setParent, setParsePriority, setProxyOf, setS, SETS, setTester, setZ, SETZ, SForProxy, tester, toJavaCode, 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 byte[] javaCompileZipBytes(byte[] jarOrZipFileBytes)
public static byte[] javaCompileSelf()
public static void javaCompileSelfSaveJar(java.lang.String pathNameOfJar)
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 | ||||||||