aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--code_obj.lua12
-rw-r--r--code_obj.moon12
-rw-r--r--compatibility/3.6.nom15
-rw-r--r--core/collections.nom2
-rw-r--r--core/control_flow.nom72
-rw-r--r--core/coroutines.nom2
-rw-r--r--core/errors.nom2
-rw-r--r--core/io.nom2
-rw-r--r--core/math.nom2
-rw-r--r--core/metaprogramming.nom19
-rw-r--r--core/operators.nom6
-rw-r--r--core/scopes.nom8
-rw-r--r--core/text.nom2
-rw-r--r--examples/how_do_i.nom2
-rw-r--r--lib/base64.nom2
-rw-r--r--lib/consolecolor.nom2
-rw-r--r--lib/file_hash.nom2
-rw-r--r--lib/object.nom2
-rw-r--r--lib/os.nom2
-rw-r--r--lib/training_wheels.nom2
-rw-r--r--lib/version.nom2
21 files changed, 76 insertions, 96 deletions
diff --git a/code_obj.lua b/code_obj.lua
index c4eb52f..d51d63f 100644
--- a/code_obj.lua
+++ b/code_obj.lua
@@ -505,12 +505,12 @@ do
end
NomsuCode = _class_0
end
-Code.__base.append_1 = Code.__base.append
-Code.__base.append_1_joined_by_2 = Code.__base.concat_append
-Code.__base.prepend_1 = Code.__base.prepend
-Code.__base.declare_locals_1 = Code.__base.declare_locals
-Code.__base.remove_free_vars_1 = Code.__base.remove_free_vars
-Code.__base.add_free_vars_1 = Code.__base.add_free_vars
+Code.__base.append_1 = assert(Code.__base.append)
+Code.__base.append_1_joined_by_2 = assert(Code.__base.concat_append)
+Code.__base.prepend_1 = assert(Code.__base.prepend)
+LuaCode.__base.declare_locals_1 = assert(LuaCode.__base.declare_locals)
+LuaCode.__base.remove_free_vars_1 = assert(LuaCode.__base.remove_free_vars)
+LuaCode.__base.add_free_vars_1 = assert(LuaCode.__base.add_free_vars)
return {
Code = Code,
NomsuCode = NomsuCode,
diff --git a/code_obj.moon b/code_obj.moon
index 3962bcc..bd53c5b 100644
--- a/code_obj.moon
+++ b/code_obj.moon
@@ -256,11 +256,11 @@ class NomsuCode extends Code
__repr: Code.__repr
__len: Code.__len
-Code.__base.append_1 = Code.__base.append
-Code.__base.append_1_joined_by_2 = Code.__base.concat_append
-Code.__base.prepend_1 = Code.__base.prepend
-Code.__base.declare_locals_1 = Code.__base.declare_locals
-Code.__base.remove_free_vars_1 = Code.__base.remove_free_vars
-Code.__base.add_free_vars_1 = Code.__base.add_free_vars
+Code.__base.append_1 = assert Code.__base.append
+Code.__base.append_1_joined_by_2 = assert Code.__base.concat_append
+Code.__base.prepend_1 = assert Code.__base.prepend
+LuaCode.__base.declare_locals_1 = assert LuaCode.__base.declare_locals
+LuaCode.__base.remove_free_vars_1 = assert LuaCode.__base.remove_free_vars
+LuaCode.__base.add_free_vars_1 = assert LuaCode.__base.add_free_vars
return {:Code, :NomsuCode, :LuaCode, :Source}
diff --git a/compatibility/3.6.nom b/compatibility/3.6.nom
index 6697375..297612a 100644
--- a/compatibility/3.6.nom
+++ b/compatibility/3.6.nom
@@ -1,21 +1,20 @@
-#!/usr/bin/env nomsu -V3
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines upgrades from Nomsu <3.6 to 3.6
use "compatibility/compatibility.nom"
-upgrade action (to %1 write %2) to "3.6" as (..)
- %1::append %2
-upgrade action (%1 <-write %2) to "3.6" as (..)
- %1::append %2
+upgrade action (to %1 write %2) to "3.6" as (%1::append %2)
+upgrade action (%1 <-write %2) to "3.6" as (%1::append %2)
upgrade action (to %1 write %2 joined by %3) to "3.6" as (..)
%1::append %2 joined by %3
-upgrade action (declare locals in %lua) to "3.6" as (..)
- %lua::declare locals
+
+upgrade action (declare locals in %lua) to "3.6" as (%lua::declare locals)
upgrade action (declare locals %locs in %lua) to "3.6" as (..)
%lua::declare locals %locs
+
upgrade action (add free vars %vars to %lua) to "3.6" as (..)
%lua::add free vars %vars
+
upgrade action (remove free vars %vars from %lua) to "3.6" as (..)
%lua::remove free vars %vars
-
diff --git a/core/collections.nom b/core/collections.nom
index 790fc56..cba20f9 100644
--- a/core/collections.nom
+++ b/core/collections.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains code that supports manipulating and using collections like lists
and dictionaries.
diff --git a/core/control_flow.nom b/core/control_flow.nom
index 5bc0811..95b9bcb 100644
--- a/core/control_flow.nom
+++ b/core/control_flow.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains compile-time actions that define basic control flow structures
like "if" statements and loops.
@@ -117,10 +117,10 @@ compile [repeat while %condition %body] to:
\(%body as lua statements)
if (%body has subtree \(do next)):
- to %lua write "\n ::continue::"
+ %lua::append "\n ::continue::"
if (%body has subtree \(do next repeat)):
- to %lua write "\n ::continue_repeat::"
- to %lua write "\nend --while-loop"
+ %lua::append "\n ::continue_repeat::"
+ %lua::append "\nend --while-loop"
if (%body has subtree \(stop repeating)):
%lua = (..)
Lua ".."
@@ -145,10 +145,10 @@ compile [repeat %n times %body] to:
\(%body as lua statements)
if (%body has subtree \(do next)):
- to %lua write "\n ::continue::"
+ %lua::append "\n ::continue::"
if (%body has subtree \(do next repeat)):
- to %lua write "\n ::continue_repeat::"
- to %lua write "\nend --numeric for-loop"
+ %lua::append "\n ::continue_repeat::"
+ %lua::append "\nend --numeric for-loop"
if (%body has subtree \(stop repeating)):
%lua = (..)
Lua ".."
@@ -205,10 +205,10 @@ compile [..]
\(%body as lua statements)
if (%body has subtree \(do next)):
- to %lua write "\n ::continue::"
+ %lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- to %lua write "\n \(compile as (===next %var ===))"
- to %lua write "\nend --numeric for-loop"
+ %lua::append "\n \(compile as (===next %var ===))"
+ %lua::append "\nend --numeric for-loop"
if (%body has subtree \(stop %var)):
%lua = (..)
Lua ".."
@@ -248,10 +248,10 @@ compile [for %var in %iterable %body] to:
\(%body as lua statements)
if (%body has subtree \(do next)):
- to %lua write "\n ::continue::"
+ %lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- to %lua write (Lua "\n\(compile as (===next %var ===))")
- to %lua write "\nend --foreach-loop"
+ %lua::append (Lua "\n\(compile as (===next %var ===))")
+ %lua::append "\nend --foreach-loop"
if (%body has subtree \(stop %var)):
%lua = (..)
Lua ".."
@@ -289,17 +289,17 @@ compile [..]
\(%body as lua statements)
if (%body has subtree \(do next)):
- to %lua write "\n ::continue::"
+ %lua::append "\n ::continue::"
if (%body has subtree \(do next %key)):
- to %lua write (Lua "\n\(compile as (===next %key ===))")
+ %lua::append (Lua "\n\(compile as (===next %key ===))")
if (%body has subtree \(do next %value)):
- to %lua write (Lua "\n\(compile as (===next %value ===))")
- to %lua write "\nend --foreach-loop"
+ %lua::append (Lua "\n\(compile as (===next %value ===))")
+ %lua::append "\nend --foreach-loop"
%stop_labels = (Lua "")
if (%body has subtree \(stop %key)):
- to %stop_labels write "\n\(compile as (===stop %key ===))"
+ %stop_labels::append "\n\(compile as (===stop %key ===))"
if (%body has subtree \(stop %value)):
- to %stop_labels write "\n\(compile as (===stop %value ===))"
+ %stop_labels::append "\n\(compile as (===stop %value ===))"
if ((length of "\%stop_labels") > 0):
%lua = (..)
Lua ".."
@@ -347,14 +347,14 @@ compile [if %body, when %body] to:
compile error at %line.source ".."
Can't have an 'else' block without a preceeding condition
- to %code write ".."
+ %code::append ".."
else
\(%action as lua statements)
%else_allowed = (no)
..else:
- to %code write "\%clause "
+ %code::append "\%clause "
for %i in 1 to ((length of %line) - 1):
unless (%line.%i is syntax tree):
compile error at %line.source ".."
@@ -362,10 +362,10 @@ compile [if %body, when %body] to:
%s
if (%i > 1):
- to %code write " or "
- to %code write (%line.%i as lua expr)
+ %code::append " or "
+ %code::append (%line.%i as lua expr)
- to %code write ".."
+ %code::append ".."
then
\(%action as lua statements)
@@ -373,7 +373,7 @@ compile [if %body, when %body] to:
if ((length of "\%code") == 0):
compile error at %body.source "'if' block has an empty body"
- to %code write "\nend --when"
+ %code::append "\nend --when"
return %code
test:
@@ -410,14 +410,14 @@ compile [if %branch_value is %body, when %branch_value is %body] to:
compile error at %line.source ".."
Can't have an 'else' block without a preceeding condition
- to %code write ".."
+ %code::append ".."
else
\(%action as lua statements)
%else_allowed = (no)
..else:
- to %code write "\%clause "
+ %code::append "\%clause "
for %i in 1 to ((length of %line) - 1):
unless (%line.%i is syntax tree):
compile error at %line.source ".."
@@ -425,10 +425,10 @@ compile [if %branch_value is %body, when %branch_value is %body] to:
%s
if (%i > 1):
- to %code write " or "
- to %code write "branch_value == \(%line.%i as lua expr)"
+ %code::append " or "
+ %code::append "branch_value == \(%line.%i as lua expr)"
- to %code write ".."
+ %code::append ".."
then
\(%action as lua statements)
@@ -436,7 +436,7 @@ compile [if %branch_value is %body, when %branch_value is %body] to:
if ((length of "\%code") == 0):
compile error at %body.source "'if % is % %' block has an empty body"
- to %code write "\nend --when"
+ %code::append "\nend --when"
return (..)
Lua ".."
do --if % is
@@ -504,11 +504,11 @@ compile [for %var in recursive %structure %body] to (..)
\(%body as lua statements)
if (%body has subtree \(do next)):
- to %lua write "\n ::continue::"
+ %lua::append "\n ::continue::"
if (%body has subtree \(do next %var)):
- to %lua write "\n \(compile as (===next %var ===))"
- to %lua write "\n end -- Recursive loop"
+ %lua::append "\n \(compile as (===next %var ===))"
+ %lua::append "\n end -- Recursive loop"
if (%body has subtree \(stop %var)):
- to %lua write "\n \(compile as (===stop %var ===))"
- to %lua write "\nend -- Recursive scope"
+ %lua::append "\n \(compile as (===stop %var ===))"
+ %lua::append "\nend -- Recursive scope"
return %lua
diff --git a/core/coroutines.nom b/core/coroutines.nom
index ff1b978..1570ed7 100644
--- a/core/coroutines.nom
+++ b/core/coroutines.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines the code that creates and manipulates coroutines
diff --git a/core/errors.nom b/core/errors.nom
index 4e87fa5..932bb25 100644
--- a/core/errors.nom
+++ b/core/errors.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains basic error reporting code
diff --git a/core/io.nom b/core/io.nom
index d5895da..856a660 100644
--- a/core/io.nom
+++ b/core/io.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains basic input/output code
diff --git a/core/math.nom b/core/math.nom
index 30332dc..778994f 100644
--- a/core/math.nom
+++ b/core/math.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines some common math literals and functions
diff --git a/core/metaprogramming.nom b/core/metaprogramming.nom
index e141bc0..bd65a7e 100644
--- a/core/metaprogramming.nom
+++ b/core/metaprogramming.nom
@@ -297,25 +297,6 @@ action [%tree with %patt ~> %replacement]:
end)
end)
-compile [declare locals in %code] to (..)
- Lua value "\(%code as lua expr):declare_locals()"
-
-compile [declare locals %locals in %code] to (..)
- Lua value "\(%code as lua expr):declare_locals(\(%locals as lua expr))"
-
-compile [add free vars %vars to %code] to (..)
- Lua "\(%code as lua expr):add_free_vars(\(%vars as lua expr));"
-
-compile [remove free vars %vars from %code] to (..)
- Lua "\(%code as lua expr):remove_free_vars(\(%vars as lua expr));"
-
-compile [%lua <-write %code, to %lua write %code] to (..)
- Lua "\(%lua as lua expr):append(\(%code as lua expr));"
-
-compile [to %lua write %code joined by %glue] to (..)
- Lua ".."
- \(%lua as lua expr):concat_append(\(%code as lua expr), \(%glue as lua expr));
-
test:
assume (..)
(..)
diff --git a/core/operators.nom b/core/operators.nom
index 699663c..fbf88bb 100644
--- a/core/operators.nom
+++ b/core/operators.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains definitions of operators like "+" and "and".
@@ -21,7 +21,7 @@ compile [%a isn't %b, %a is not %b, %a not= %b, %a != %b] to (..)
# For strict identity checking, use (%x's id) is (%y's id)
test:
- assume (([] == []) and (([]'s id) != ([]'s id)))
+ assume (([] == []) and (([] 's id) != ([] 's id)))
lua> ".."
do
local new_uuid = require('uuid')
@@ -238,7 +238,7 @@ compile [%x or %y] to (Lua value "(\(%x as lua expr) or \(%y as lua expr))")
# Bitwise Operators
# TODO: implement OR, XOR, AND for multiple operands?
test:
- assume ((~5) == -6)
+ assume ((~ 5) == -6)
assume ((1 | 4) == 5)
assume ((1 ~ 3) == 2)
assume ((1 & 3) == 1)
diff --git a/core/scopes.nom b/core/scopes.nom
index 101f955..392649b 100644
--- a/core/scopes.nom
+++ b/core/scopes.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains definitions pertaining to variable scoping
@@ -29,12 +29,12 @@ compile [with local %locals %body, with local %locals do %body] to:
\(compile as (<- %locals))
\%body_lua
- declare locals ("\(%.1 as lua)" for % in %locals) in %body_lua
+ %body_lua::declare locals ("\(%.1 as lua)" for % in %locals)
"List":
- declare locals ("\(% as lua)" for % in %locals) in %body_lua
+ %body_lua::declare locals ("\(% as lua)" for % in %locals)
"Var" "Action":
- declare locals ["\(%locals as lua)"] in %body_lua
+ %body_lua::declare locals ["\(%locals as lua)"]
else:
compile error at %locals.source "Unexpected locals: %s"
diff --git a/core/text.nom b/core/text.nom
index 00a3c4b..25d4066 100644
--- a/core/text.nom
+++ b/core/text.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains some definitions of text escape sequences, including ANSI console
color codes.
diff --git a/examples/how_do_i.nom b/examples/how_do_i.nom
index cb2cdda..6638902 100644
--- a/examples/how_do_i.nom
+++ b/examples/how_do_i.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
# How do I...
# Write a comment? Put a # and go till the end of the line
# How do I write a multi-line comment?
diff --git a/lib/base64.nom b/lib/base64.nom
index 8de1ba8..2b7e22e 100644
--- a/lib/base64.nom
+++ b/lib/base64.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines actions for encoding/decoding base 64, as specified in:
https://tools.ietf.org/html/rfc4648
diff --git a/lib/consolecolor.nom b/lib/consolecolor.nom
index 6ecf40b..881109d 100644
--- a/lib/consolecolor.nom
+++ b/lib/consolecolor.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines actions for ANSI console color escape codes.
diff --git a/lib/file_hash.nom b/lib/file_hash.nom
index b3d1919..188df78 100644
--- a/lib/file_hash.nom
+++ b/lib/file_hash.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines some actions for hashing files and looking up files by hash.
diff --git a/lib/object.nom b/lib/object.nom
index 47a7839..67c6b73 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains the implementation of an Object-Oriented programming system.
diff --git a/lib/os.nom b/lib/os.nom
index 73db72b..c4f9ffe 100644
--- a/lib/os.nom
+++ b/lib/os.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file defines some actions that interact with the operating system and filesystem.
diff --git a/lib/training_wheels.nom b/lib/training_wheels.nom
index 28b82ce..6dcbb42 100644
--- a/lib/training_wheels.nom
+++ b/lib/training_wheels.nom
@@ -1,4 +1,4 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
#
This file contains a set of definitions that bring some familiar language features
from other languages into nomsu (e.g. "||" and "continue")
diff --git a/lib/version.nom b/lib/version.nom
index 9c34e4b..0b11245 100644
--- a/lib/version.nom
+++ b/lib/version.nom
@@ -1,3 +1,3 @@
-#!/usr/bin/env nomsu -V3.5.5.6
+#!/usr/bin/env nomsu -V3.6.5.6
# This file sets the current library version.
lua> "NOMSU_LIB_VERSION = 6"