Add instructions
This commit is contained in:
18
bcinterpreter.lua
Normal file
18
bcinterpreter.lua
Normal file
@@ -0,0 +1,18 @@
|
||||
require("varreg")
|
||||
require("instructions")
|
||||
require("util")
|
||||
|
||||
local program = {
|
||||
{
|
||||
"PRINTV",
|
||||
"hello",
|
||||
},
|
||||
{
|
||||
"PRINTV",
|
||||
"world",
|
||||
},
|
||||
}
|
||||
|
||||
for _, instruction in ipairs(program) do
|
||||
InstructionTable[string.lower(instruction[1])](Slice(instruction, 2))
|
||||
end
|
||||
8
instructions.lua
Normal file
8
instructions.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
InstructionTable = {
|
||||
-- Print explicitly stated constants
|
||||
printv = function(args)
|
||||
for _, arg in ipairs(args) do
|
||||
print(arg)
|
||||
end
|
||||
end,
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
require("varreg.lua")
|
||||
Reference in New Issue
Block a user