This commit is contained in:
Andre Wagner
2026-05-07 20:26:03 -05:00
parent 4a23c52781
commit 9ff38cd4c0
3 changed files with 59 additions and 36 deletions

View File

@@ -71,30 +71,30 @@ do TEST "Parser"
assert_eq(found, expected)
end
--do TEST "Parser: labels"
--
-- local source = [[
-- .func 0
-- jmp %my_label
-- pushi 3
-- %my_label:
-- ret ]]
--
-- local expected = {
-- constants = {},
-- functions = {
-- [0] = {
-- { "jmp", "%my_label" },
-- { "pushi", 3 },
-- { "ret", labels = { "%my_label" } },
-- }
-- }
-- }
--
-- local found = assemble(source)
-- pprint(found)
-- assert_eq(found, expected)
--end
do TEST "Parser: labels"
local source = [[
.func 0
jmp @my_label
pushi 3
@my_label:
ret ]]
local expected = {
constants = {},
functions = {
[0] = {
{ "jmp", "@my_label" },
{ "pushi", 3 },
{ "ret", labels = { "@my_label" } },
}
}
}
local found = assemble(source)
pprint(found)
assert_eq(found, expected)
end
----------------------
-- --