aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compatibility/2.3.nom1
-rw-r--r--compatibility/2.4.nom1
-rw-r--r--compatibility/2.5.nom1
-rw-r--r--compatibility/2.nom1
-rw-r--r--compatibility/compatibility.nom1
-rw-r--r--examples/how_do_i.nom4
-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--nomsu.lua11
-rwxr-xr-xnomsu.moon9
-rwxr-xr-xtools/autoformat.nom1
-rwxr-xr-xtools/find_action.nom1
-rwxr-xr-xtools/parse.nom1
-rwxr-xr-xtools/test.nom1
-rwxr-xr-xtools/upgrade.nom1
18 files changed, 20 insertions, 24 deletions
diff --git a/compatibility/2.3.nom b/compatibility/2.3.nom
index 46ce6a0..681ce89 100644
--- a/compatibility/2.3.nom
+++ b/compatibility/2.3.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "compatibility/compatibility.nom"
upgrade action (%a = %b) to "2.3" as (%a == %b)
diff --git a/compatibility/2.4.nom b/compatibility/2.4.nom
index 958c6bf..8a49e39 100644
--- a/compatibility/2.4.nom
+++ b/compatibility/2.4.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "compatibility/compatibility.nom"
upgrade %tree to "2.4" as:
diff --git a/compatibility/2.5.nom b/compatibility/2.5.nom
index 118c13e..a67a28b 100644
--- a/compatibility/2.5.nom
+++ b/compatibility/2.5.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "compatibility/compatibility.nom"
upgrade action (for %1 where %2 matches %3 %4) to "2.5" as (..)
diff --git a/compatibility/2.nom b/compatibility/2.nom
index a7a3afe..94517ea 100644
--- a/compatibility/2.nom
+++ b/compatibility/2.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "compatibility/compatibility.nom"
upgrade %tree to "2" as:
diff --git a/compatibility/compatibility.nom b/compatibility/compatibility.nom
index b936efb..a0a1b1b 100644
--- a/compatibility/compatibility.nom
+++ b/compatibility/compatibility.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "lib/os.nom"
%UPGRADES = {}
diff --git a/examples/how_do_i.nom b/examples/how_do_i.nom
index 03a910a..bb5df5a 100644
--- a/examples/how_do_i.nom
+++ b/examples/how_do_i.nom
@@ -7,10 +7,10 @@
(including any deeper-level indented text)
The comment ends when the indentation ends
# How do I import a file?
-use "core/control_flow.nom"
+use "lib/os.nom"
# How do I import all the files in a directory?
-use "core"
+use "lib"
# How do I print stuff?
say "Hello world!"
diff --git a/lib/consolecolor.nom b/lib/consolecolor.nom
index 35b6f42..d473d7c 100644
--- a/lib/consolecolor.nom
+++ b/lib/consolecolor.nom
@@ -2,8 +2,6 @@
#
This file defines actions for ANSI console color escape codes.
-use "core"
-
test:
bright "\(green)Color test passed."
diff --git a/lib/file_hash.nom b/lib/file_hash.nom
index 07fe275..41a26c2 100644
--- a/lib/file_hash.nom
+++ b/lib/file_hash.nom
@@ -2,8 +2,6 @@
#
This file defines some actions for hashing files and looking up files by hash.
-use "core"
-
action [file with hash %hash]:
lua> ".."
local Hash = require("openssl.digest")
diff --git a/lib/object.nom b/lib/object.nom
index 10b0afa..4ed9bcd 100644
--- a/lib/object.nom
+++ b/lib/object.nom
@@ -2,8 +2,6 @@
#
This file contains the implementation of an Object-Oriented programming system.
-use "core"
-
test:
object "Dog":
(class Dog).genus = "Canus"
diff --git a/lib/os.nom b/lib/os.nom
index 223c139..8ee2ef3 100644
--- a/lib/os.nom
+++ b/lib/os.nom
@@ -2,8 +2,6 @@
#
This file defines some actions that interact with the operating system and filesystem.
-use "core"
-
test:
path of Nomsu file "lib/os.nom"
diff --git a/lib/training_wheels.nom b/lib/training_wheels.nom
index e89eee3..b68fc56 100644
--- a/lib/training_wheels.nom
+++ b/lib/training_wheels.nom
@@ -3,8 +3,6 @@
This file contains a set of definitions that bring some familiar language features
from other languages into nomsu (e.g. "==" and "continue")
-use "core"
-
parse [%a == %b] as (%a = %b)
parse [%a == %b] as (%a is %b)
parse [%a ~= %b, %a != %b, %a <> %b] as (%a is not %b)
diff --git a/nomsu.lua b/nomsu.lua
index d29167e..8918b11 100644
--- a/nomsu.lua
+++ b/nomsu.lua
@@ -53,7 +53,7 @@ end
local EXIT_SUCCESS, EXIT_FAILURE = 0, 1
local usage = [=[Nomsu Compiler
-Usage: (nomsu | lua nomsu.lua | moon nomsu.moon) [-V version] [-O] [-v] [-c] [-s] [-t] [-I file] [--help | -h] [--version] [file [nomsu args...]]
+Usage: (nomsu | lua nomsu.lua | moon nomsu.moon) [-V version] [-O] [-v] [-c] [-s] [-t] [-I file] [--help | -h] [--version] [--no-core] [file [nomsu args...]]
OPTIONS
-O Run the compiler in optimized mode (use precompiled .lua versions of Nomsu files, when available).
@@ -65,6 +65,7 @@ OPTIONS
-d <debugger> Attempt to use the specified debugger to wrap the main body of execution.
-h/--help Print this message.
--version Print the version number and exit.
+ --no-core Skip loading the Nomsu core by default.
-V specify which Nomsu version is desired.
<file> The Nomsu file to run (can be "-" to use stdin).
]=]
@@ -102,6 +103,7 @@ local parser = re.compile([[ args <- {| (flag %sep)* (({~ file ~} -> add_file
/ {:verbose: ("-v" -> true) :}
/ {:help: (("-h" / "--help") -> true) :}
/ {:version: ("--version" -> true) :}
+ / {:no_core: ("--no-core" -> true) :}
/ {:debugger: ("-d" %sep? {(!%sep .)*}) :}
/ {:requested_version: "-V" (%sep? {([0-9.])+})? :}
file <- ("-" -> "stdin") / {(!%sep .)+}
@@ -165,6 +167,13 @@ run = function()
end
return true
end
+ if not (args.no_core) then
+ for _, filename in Files.walk('core') do
+ if filename:match("%.nom$") then
+ nomsu:run_file(filename)
+ end
+ end
+ end
local get_file_and_source
get_file_and_source = function(filename)
local file, source
diff --git a/nomsu.moon b/nomsu.moon
index c30004d..16d4bb3 100755
--- a/nomsu.moon
+++ b/nomsu.moon
@@ -11,7 +11,7 @@ EXIT_SUCCESS, EXIT_FAILURE = 0, 1
usage = [=[
Nomsu Compiler
-Usage: (nomsu | lua nomsu.lua | moon nomsu.moon) [-V version] [-O] [-v] [-c] [-s] [-t] [-I file] [--help | -h] [--version] [file [nomsu args...]]
+Usage: (nomsu | lua nomsu.lua | moon nomsu.moon) [-V version] [-O] [-v] [-c] [-s] [-t] [-I file] [--help | -h] [--version] [--no-core] [file [nomsu args...]]
OPTIONS
-O Run the compiler in optimized mode (use precompiled .lua versions of Nomsu files, when available).
@@ -23,6 +23,7 @@ OPTIONS
-d <debugger> Attempt to use the specified debugger to wrap the main body of execution.
-h/--help Print this message.
--version Print the version number and exit.
+ --no-core Skip loading the Nomsu core by default.
-V specify which Nomsu version is desired.
<file> The Nomsu file to run (can be "-" to use stdin).
]=]
@@ -58,6 +59,7 @@ parser = re.compile([[
/ {:verbose: ("-v" -> true) :}
/ {:help: (("-h" / "--help") -> true) :}
/ {:version: ("--version" -> true) :}
+ / {:no_core: ("--no-core" -> true) :}
/ {:debugger: ("-d" %sep? {(!%sep .)*}) :}
/ {:requested_version: "-V" (%sep? {([0-9.])+})? :}
file <- ("-" -> "stdin") / {(!%sep .)+}
@@ -110,6 +112,11 @@ run = ->
return false if args.compile and input_files[f]
return true
+ unless args.no_core
+ for _,filename in Files.walk('core')
+ if filename\match "%.nom$"
+ nomsu\run_file filename
+
get_file_and_source = (filename)->
local file, source
if filename == 'stdin'
diff --git a/tools/autoformat.nom b/tools/autoformat.nom
index 1c591a0..971aec3 100755
--- a/tools/autoformat.nom
+++ b/tools/autoformat.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "lib/os.nom"
%args = (command line args)
diff --git a/tools/find_action.nom b/tools/find_action.nom
index b51a0f8..716fc9f 100755
--- a/tools/find_action.nom
+++ b/tools/find_action.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "lib/os.nom"
use "lib/consolecolor.nom"
diff --git a/tools/parse.nom b/tools/parse.nom
index 35613d2..2c70f71 100755
--- a/tools/parse.nom
+++ b/tools/parse.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "lib/os.nom"
action [print tree %t at indent %indent]:
diff --git a/tools/test.nom b/tools/test.nom
index 3f2622e..1cad598 100755
--- a/tools/test.nom
+++ b/tools/test.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "lib/os.nom"
use "lib/consolecolor.nom"
diff --git a/tools/upgrade.nom b/tools/upgrade.nom
index 690d4fb..a051818 100755
--- a/tools/upgrade.nom
+++ b/tools/upgrade.nom
@@ -1,5 +1,4 @@
#!/usr/bin/env nomsu -V2.5.4.3
-use "core"
use "compatibility"
use "lib/os.nom"