Compare commits
No commits in common. "e8cfd059cc543b3488c98a7efd8f6bbc1540d090" and "09c3c3277b2b59660e880cee3a1227bec250203c" have entirely different histories.
e8cfd059cc
...
09c3c3277b
34
compiler/architecture.txt
Normal file
34
compiler/architecture.txt
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Mnemonic Arg Arg description
|
||||||
|
----------------------------------------
|
||||||
|
Nop
|
||||||
|
PushNull
|
||||||
|
PushInt int initial value
|
||||||
|
PushString string initial value
|
||||||
|
PushArray
|
||||||
|
PushStruct
|
||||||
|
PushPtr ptr pointer value
|
||||||
|
Pop
|
||||||
|
LoadLocal int stack position
|
||||||
|
StoreLocal int stack position
|
||||||
|
Call int arg count
|
||||||
|
Return
|
||||||
|
Jump
|
||||||
|
JumpIfNotZero
|
||||||
|
Add
|
||||||
|
Subtract
|
||||||
|
Multiply
|
||||||
|
Divide
|
||||||
|
Remainder
|
||||||
|
Equal
|
||||||
|
LessThan
|
||||||
|
And
|
||||||
|
Or
|
||||||
|
Xor
|
||||||
|
Not
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,22 +1,5 @@
|
|||||||
type Pack = {
|
import { Compiler } from "./compiler.ts";
|
||||||
rootMod: Mod;
|
|
||||||
};
|
|
||||||
|
|
||||||
type Mod = null;
|
const { program } = await new Compiler(Deno.args[0]).compile();
|
||||||
|
|
||||||
interface PackEmitter {
|
await Deno.writeTextFile("out.slgbc", JSON.stringify(program));
|
||||||
emit(pack: Pack): void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class PackCompiler {
|
|
||||||
public constructor(
|
|
||||||
private entryFilePath: string,
|
|
||||||
private emitter: PackEmitter,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public compile() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class ModResolver {
|
|
||||||
}
|
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
import { Compiler } from "./compiler.ts";
|
|
||||||
|
|
||||||
const { program } = await new Compiler(Deno.args[0]).compile();
|
|
||||||
|
|
||||||
await Deno.writeTextFile("out.slgbc", JSON.stringify(program));
|
|
Loading…
x
Reference in New Issue
Block a user