Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroflag committed Dec 27, 2024
1 parent 364b96b commit 1ea100e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dict.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ dict.defword("else", "macros._else", true)
dict.defword("begin", "macros._begin", true)
dict.defword("until", "macros._until", true)
dict.defword("->", "macros.assignment", true)
dict.defword("local", "macros._local", true)
dict.defword("var", "macros.var", true)
dict.defword("(", "macros.comment", true)
dict.defword("\\", "macros.single_line_comment", true)
dict.defword(":", "macros.colon", true)
Expand Down
2 changes: 1 addition & 1 deletion macros.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function macros.single_line_comment(compiler)
repeat until "\n" == compiler:next()
end

function macros._local(compiler)
function macros.var(compiler)
local alias = compiler:word()
local name = "v_" .. alias
compiler:defvar(alias, name)
Expand Down
9 changes: 6 additions & 3 deletions test_compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,14 +155,17 @@ assert_tos(5, [[

-- var local
assert_tos(22, [[
local v1 local v2
10 -> v1 12 -> v2
var v1
var v2
10 -> v1
12 -> v2
v1 v2 +
]])

-- var local
assert_tos(-3, [[
local v1 local v2
var v1
var v2
10 -> v1 v1 -> v2
3 v2 + -> v2 ( 13 = v2 )
v1 v2 - ( 10 13 - )
Expand Down

0 comments on commit 1ea100e

Please sign in to comment.