Difference between revisions of "LS2IL"
From ismods.com: dedicated to promoting white hat, EULA-compliant Inner Space and LavishScript mods
(Created page with "LS2IL is the custom IL used the current LavishScript 2 assembler, as built into ls2il.exe with the standard LavishScript 2 execution environm...") |
|||
Line 36: | Line 36: | ||
== See Also == | == See Also == | ||
* [[LS2IL:Instruction Reference|Instruction Reference]] | * [[LS2IL:Instruction Reference|Instruction Reference]] | ||
+ | |||
+ | [[Category:LS2IL]] |
Revision as of 17:34, 9 September 2012
LS2IL is the custom IL used the current LavishScript 2 assembler, as built into ls2il.exe with the standard LavishScript 2 execution environment.
Here's the basics:
- The text of a LS2IL file or buffer defines a Chunk of code.
- Chunks have Values (i.e. script-scope data) and Functions.
- IL-definable Values currently can be:
- null
- 64-bit integer in 8, 16, 32 or 64 bits of bytecode storage, e.g. .value i8 255 to add an integer 255 stored in 8 bits or simply .value 255 to let the assembler decide
- 64-bit floating point (32 or 64-bit bytecode storage)
- binary denoted by || and given in hex pairs
- string denoted by ""
- arrays (0-based ordered list of Values) denoted by {}, e.g. {1, 2.0, | 03 |, "4"}
- tables (Values keyed by string) denoted by [key=value], e.g. [ "apples"=2 , "oranges"=3.0 , "ducks"={"all","in","a","row"} ]
- Functions have up to 256 Registers, any number of Values (i.e. static function-scope data), and any number of Instructions. Parameters passed to the function are called Inputs to the Function. Functions in the VM don't return a Value; they will instead do so by modifying the Inputs!
- Instructions have the instruction/opcode and up to 3 Operands.
- Operands are the same as Values but can also be one of the following:
- chunkvalue[#]: 0-based Chunk Value
- exception: Exception currently being handled (hopefully in your exception handler)
- function: Function currently being executed
- function[#]: 0-based Function from the Chunk
- functionvalue[#]: 0-based Function Value (Value from current Function)
- input[#]: 0-based Input
- register[#]: 0-based Register
Hello World!
; Hello World! function .registers 1 RESOLVETYPE 0, "System.Console" RESOLVESTATICMETHOD 0, register[0], "Print" FASTCALLSTATICMETHOD register[0], "Hello World!" endfunction