nomsu/core/scopes.nom
Bruce Hill 86a3219e7f Cleanup of some metaprogramming stuff, as well as adding support for
"package.nomsupath" to search for files in different locations, and
prioritizing use of "luafilesystem" over system calls.
2018-06-21 19:13:47 -07:00

31 lines
870 B
Plaintext

use "core/metaprogramming.nom"
use "core/operators.nom"
use "core/collections.nom"
use "core/control_flow.nom"
compile [with local %locals %body, with local %locals do %body] to
%body_lua <- (%body as lua statements)
when %locals.type = ?
* "Dict"
%body_lua <-
Lua ".."
\(compile as: <- %locals)
\%body_lua
declare locals
"\(%.1 as lua)" for % in %locals
.. in %body_lua
* "List"
declare locals
"\(% as lua)" for % in %locals
.. in %body_lua
* "Var"
* "Action"
declare locals ["\(%locals as lua)"] in %body_lua
* else
barf "Unexpected local: \(%locals as nomsu)"
return
Lua ".."
do
\%body_lua
end