Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroflag committed Dec 26, 2024
1 parent a796213 commit 2011d97
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function compiler.next(self)
return self.input:next()
end

function compiler.emit_string(self, token)
function compiler.emit_lit(self, token)
self:emit_line("ops.lit(" .. token .. ")")
end

Expand All @@ -51,10 +51,6 @@ function compiler.emit_word(self, word)
end
end

function compiler.emit_number(self, num)
self:emit_line("ops.lit(" .. num .. ")")
end

function compiler.emit_lua_call(self, name, arity, vararg)
if vararg then
error(name .. " has variable number of arguments." ..
Expand All @@ -73,15 +69,15 @@ end

function compiler.compile_token(self, token, kind)
if kind == "string" then
self:emit_string(token)
self:emit_lit(token)
else
local word = dict.find(token)
if word then
self:emit_word(word)
else
local num = tonumber(token)
if num then
self:emit_number(num)
self:emit_lit(num)
else
local res = interop.resolve_lua_func_with_arity(token)
if res then
Expand Down

0 comments on commit 2011d97

Please sign in to comment.