aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-09-13 16:22:04 -0700
committerBruce Hill <bitbucket@bruce-hill.com>2017-09-13 16:22:04 -0700
commit6b5fbd436bb5caf99b152dfa418317dfc1fca272 (patch)
tree82cfe4357060f8021ead30e40024cc05dc48b6c2
parentd27561b16a30223751998e0e02ba9e3d7289436f (diff)
Renamed Compiler -> NomsuCompiler
-rw-r--r--nomsu.lua15
-rwxr-xr-xnomsu.moon13
2 files changed, 14 insertions, 14 deletions
diff --git a/nomsu.lua b/nomsu.lua
index bc7ec80..c3c3f40 100644
--- a/nomsu.lua
+++ b/nomsu.lua
@@ -119,7 +119,7 @@ make_parser = function(lingo, extra_definitions)
})
return re.compile(lingo, defs)
end
-local Compiler
+local NomsuCompiler
do
local _class_0
local _base_0 = {
@@ -771,7 +771,7 @@ do
return self:initialize_core()
end,
__base = _base_0,
- __name = "Compiler"
+ __name = "NomsuCompiler"
}, {
__index = _base_0,
__call = function(cls, ...)
@@ -803,10 +803,10 @@ do
return coroutine.yield(buffer)
end)
end
- Compiler = _class_0
+ NomsuCompiler = _class_0
end
if arg and arg[1] then
- local c = Compiler()
+ local c = NomsuCompiler()
local input = io.open(arg[1]):read("*a")
local _print = print
local _io_write = io.write
@@ -829,11 +829,10 @@ if arg and arg[1] then
output:write(code)
output:write([[
end
- local utils = require('utils')
- local Compiler = require('nomsu')
- local c = Compiler()
+ local NomsuCompiler = require('nomsu')
+ local c = NomsuCompiler()
load()(c, {})
]])
end
end
-return Compiler
+return NomsuCompiler
diff --git a/nomsu.moon b/nomsu.moon
index 07a38a1..bb98f1e 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -5,6 +5,8 @@ utils = require 'utils'
-- TODO:
-- string interpolation
+-- improve indentation of generated lua code
+-- provide way to run precompiled nomsu -> lua code
-- comprehensions?
-- dicts?
-- better scoping?
@@ -85,7 +87,7 @@ make_parser = (lingo, extra_definitions)->
})
return re.compile lingo, defs
-class Compiler
+class NomsuCompiler
new:(parent)=>
@defs = setmetatable({}, {__index:parent and parent.defs})
@callstack = {}
@@ -535,7 +537,7 @@ class Compiler
-- Run on the command line via "./nomsu.moon input_file.nom" to execute
-- and "./nomsu.moon input_file.nom output_file.lua" to compile (use "-" to compile to stdout)
if arg and arg[1]
- c = Compiler()
+ c = NomsuCompiler()
input = io.open(arg[1])\read("*a")
-- Kinda hacky, if run via "./nomsu.moon file.nom -", then silence print and io.write
-- during execution and re-enable them to print out the generated source code
@@ -560,10 +562,9 @@ if arg and arg[1]
output\write [[
end
- local utils = require('utils')
- local Compiler = require('nomsu')
- local c = Compiler()
+ local NomsuCompiler = require('nomsu')
+ local c = NomsuCompiler()
load()(c, {})
]]
-return Compiler
+return NomsuCompiler