diff --git a/.gitignore b/blspc/.gitignore similarity index 100% rename from .gitignore rename to blspc/.gitignore diff --git a/Cargo.lock b/blspc/Cargo.lock similarity index 100% rename from Cargo.lock rename to blspc/Cargo.lock diff --git a/Cargo.toml b/blspc/Cargo.toml similarity index 100% rename from Cargo.toml rename to blspc/Cargo.toml diff --git a/Makefile b/blspc/Makefile similarity index 100% rename from Makefile rename to blspc/Makefile diff --git a/README.md b/blspc/README.md similarity index 100% rename from README.md rename to blspc/README.md diff --git a/example/hello.blsp b/blspc/example/hello.blsp similarity index 100% rename from example/hello.blsp rename to blspc/example/hello.blsp diff --git a/blspc/example/if.blsp b/blspc/example/if.blsp new file mode 100644 index 0000000..f0c6555 --- /dev/null +++ b/blspc/example/if.blsp @@ -0,0 +1 @@ +(if true (print "True") (print "False")) \ No newline at end of file diff --git a/example/math.blsp b/blspc/example/math.blsp similarity index 100% rename from example/math.blsp rename to blspc/example/math.blsp diff --git a/example/s.blsp b/blspc/example/s.blsp similarity index 100% rename from example/s.blsp rename to blspc/example/s.blsp diff --git a/src/args.rs b/blspc/src/args.rs similarity index 100% rename from src/args.rs rename to blspc/src/args.rs diff --git a/src/compiler/compile.rs b/blspc/src/compiler/compile.rs similarity index 100% rename from src/compiler/compile.rs rename to blspc/src/compiler/compile.rs diff --git a/src/compiler/lib.rs b/blspc/src/compiler/lib.rs similarity index 80% rename from src/compiler/lib.rs rename to blspc/src/compiler/lib.rs index 74e7c6e..65001d3 100644 --- a/src/compiler/lib.rs +++ b/blspc/src/compiler/lib.rs @@ -35,14 +35,16 @@ pub enum Instr { // Load a literal value onto the stack. Load { address: Register }, // Store a literal value into a register. - Store { address: Register, value: Type, }, + Store { address: Register, value: Type }, // Call intrinsic function. Call { address: Register, args: Register }, // Immediate arithmetic. - IAdd { lhs: Register, rhs: Register, to: Register, }, - ISub { lhs: Register, rhs: Register, to: Register, }, - IMul { lhs: Register, rhs: Register, to: Register, }, - IDiv { lhs: Register, rhs: Register, to: Register, }, + IAdd { lhs: Register, rhs: Register, to: Register }, + ISub { lhs: Register, rhs: Register, to: Register }, + IMul { lhs: Register, rhs: Register, to: Register }, + IDiv { lhs: Register, rhs: Register, to: Register }, + // Jumping + JumpIfFalse { cond: Register, to: Register }, } impl Display for Instr { @@ -55,6 +57,7 @@ impl Display for Instr { Instr::ISub { lhs, rhs, to } => write!(f, "ISUB {} {} {}", lhs, rhs, to), Instr::IMul { lhs, rhs, to } => write!(f, "IMUL {} {} {}", lhs, rhs, to), Instr::IDiv { lhs, rhs, to } => write!(f, "IDIV {} {} {}", lhs, rhs, to), + Instr::JumpIfFalse { cond, to } => write!(f, "JUMP_IF_FALSE {} {}", cond, to), } } } \ No newline at end of file diff --git a/src/compiler/mod.rs b/blspc/src/compiler/mod.rs similarity index 100% rename from src/compiler/mod.rs rename to blspc/src/compiler/mod.rs diff --git a/src/main.rs b/blspc/src/main.rs similarity index 100% rename from src/main.rs rename to blspc/src/main.rs diff --git a/src/parser.rs b/blspc/src/parser.rs similarity index 100% rename from src/parser.rs rename to blspc/src/parser.rs diff --git a/src/util.rs b/blspc/src/util.rs similarity index 100% rename from src/util.rs rename to blspc/src/util.rs