aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/compatibility/2.4.nom14
-rw-r--r--lib/compatibility/2.nom3
-rw-r--r--lib/compatibility/4.8.10.nom28
-rw-r--r--lib/compatibility/4.9.nom2
-rw-r--r--lib/compatibility/5.13.nom4
-rw-r--r--lib/compatibility/6.14.nom4
-rw-r--r--lib/compatibility/compatibility.nom2
-rw-r--r--lib/core/control_flow.nom26
-rw-r--r--lib/core/things.nom2
-rw-r--r--lib/shell/init.nom7
-rwxr-xr-xlib/tools/find.nom4
-rwxr-xr-xlib/tools/tutorial.nom6
12 files changed, 49 insertions, 53 deletions
diff --git a/lib/compatibility/2.4.nom b/lib/compatibility/2.4.nom
index 17a2df5..b28893a 100644
--- a/lib/compatibility/2.4.nom
+++ b/lib/compatibility/2.4.nom
@@ -30,7 +30,7 @@ upgrade $tree to "2.4" as:
$new_lines, add $line
($line.stub == "* else"):
- $new_lines, add ("Action" tree with "else" $line.3)
+ $new_lines, add (else `$line.3)
else:
$conditions, add $line.2
@@ -44,9 +44,7 @@ upgrade $tree to "2.4" as:
")
$conditions = []
- return
- "Action" tree with "when"
- "Block" tree from $tree.2.source with (unpack $new_lines)
+ return `(when `("Block" tree from $tree.2.source with (unpack $new_lines)))
"if 1 is ?" "if 1 = ?":
$values = []
@@ -66,7 +64,7 @@ upgrade $tree to "2.4" as:
$new_lines, add $line
($line.stub == "* else"):
- $new_lines, add ("Action" tree with "else" $line.3)
+ $new_lines, add (else `$line.3)
else:
$values, add $line.2
@@ -79,5 +77,7 @@ upgrade $tree to "2.4" as:
$values = []
return
- "Action" tree with "if" ($tree.2 upgraded) "is"
- "Block" tree from $tree.5.source with (unpack $new_lines)
+ `(
+ if `($tree.2 upgraded) is
+ `("Block" tree from $tree.5.source with (unpack $new_lines))
+ )
diff --git a/lib/compatibility/2.nom b/lib/compatibility/2.nom
index 2deeca2..4dc867d 100644
--- a/lib/compatibility/2.nom
+++ b/lib/compatibility/2.nom
@@ -17,8 +17,7 @@ upgrade $tree to "2" as:
unless ($false_body is "Block" syntax tree):
$false_body = (=lua "Block(\$false_body.source, \$false_body)")
- return
- "Action" tree with "if" ($tree.2 upgraded) $true_body "else" $false_body
+ return `(if `($tree.2 upgraded) `$true_body else `$false_body)
$need_blocks = [
"if", "unless", "for 1 in", "for 1 = 2 in", "repeat while 1", "repeat 1 times"
diff --git a/lib/compatibility/4.8.10.nom b/lib/compatibility/4.8.10.nom
index 3ec7421..ee60a61 100644
--- a/lib/compatibility/4.8.10.nom
+++ b/lib/compatibility/4.8.10.nom
@@ -13,12 +13,12 @@ upgrade action "local action" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return ("Action" tree with $spec.1 "means" $body)
+ return `(`$spec.1 means `$body)
..else:
- return ("Action" tree with $spec "all" "mean" $body)
+ return `(`$spec all mean `$body)
else:
- return ("Action" tree with $spec "means" $body)
+ return `(`$spec means `$body)
upgrade action "action" to "4.8.10" via
for ($tree $end_version):
@@ -28,14 +28,14 @@ upgrade action "action" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return ("Action" tree with "externally" $spec.1 "means" $body)
+ return `(externally `$spec.1 means `$body)
..else:
- return ("Action" tree with "externally" $spec "all" "mean" $body)
+ return `(externally `$spec all mean `$body)
else:
- return ("Action" tree with "externally" $spec "means" $body)
+ return `(externally `$spec means `$body)
..else:
- return ("Action" tree with $spec "'" "s" "meaning")
+ return `((`$spec)'s meaning)
upgrade action "compile 1 to" to "4.8.10" via
for ($tree $end_version):
@@ -44,12 +44,12 @@ upgrade action "compile 1 to" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return ("Action" tree with $spec.1 "compiles" "to" $body)
+ return `(`$spec.1 compiles to `$body)
..else:
- return ("Action" tree with $spec "all" "compile" "to" $body)
+ return `(`$spec all compile to `$body)
else:
- return ("Action" tree with $spec "compiles" "to" $body)
+ return `(`$spec compiles to `$body)
upgrade action "parse 1 as" to "4.8.10" via
for ($tree $end_version):
@@ -58,12 +58,12 @@ upgrade action "parse 1 as" to "4.8.10" via
if $spec.type is:
"List":
if (#$spec == 1):
- return ("Action" tree with $spec.1 "parses" "as" $body)
+ return `(`$spec.1 parses as `$body)
..else:
- return ("Action" tree with $spec "all" "parse" "as" $body)
+ return `(`$spec all parse as `$body)
else:
- return ("Action" tree with $spec "parse" "as" $body)
+ return `(`$spec parse as `$body)
upgrade action (compile as $) to "4.8.10" as (what $ compiles to)
-upgrade action (remove action $) to "4.8.10" as (($'s meaning) = (nil)) \ No newline at end of file
+upgrade action (remove action $) to "4.8.10" as (($'s meaning) = (nil))
diff --git a/lib/compatibility/4.9.nom b/lib/compatibility/4.9.nom
index 9371f8c..ddb6b9f 100644
--- a/lib/compatibility/4.9.nom
+++ b/lib/compatibility/4.9.nom
@@ -10,4 +10,4 @@ upgrade action "if" to "4.9" via
for ($tree $end_version):
if (#$tree > 2):
return $tree
- return ("Action" tree with "when" $tree.2) \ No newline at end of file
+ return `(when `$tree.2)
diff --git a/lib/compatibility/5.13.nom b/lib/compatibility/5.13.nom
index c2ab90e..3073fdf 100644
--- a/lib/compatibility/5.13.nom
+++ b/lib/compatibility/5.13.nom
@@ -17,6 +17,6 @@ upgrade action "with" to "5.13" via
when:
(($a.type == "DictEntry") and (#$a == 1)): $a = $a.1
(all of [$a.type == "DictEntry", #$a == 2]):
- $a = ("Action" tree with $a.1 "=" $a.2)
+ $a = `(`$a.1 = `$a.2)
$new_assignments.$i = $a
- return ("Action" tree with "with" $new_assignments $body)
+ return `(with `$new_assignments `$body)
diff --git a/lib/compatibility/6.14.nom b/lib/compatibility/6.14.nom
index b809afd..0d6b8de 100644
--- a/lib/compatibility/6.14.nom
+++ b/lib/compatibility/6.14.nom
@@ -28,7 +28,7 @@ upgrade action (assume $assumption or barf $err) to "6.14" as
unless $assumption: fail $err
upgrade action (barf $msg) to "6.14" as (fail $msg)
-upgrade action ("Action" tree with 1 "'" "s" "meaning").stub to "6.14" via
+upgrade action (`(1's meaning)).stub to "6.14" via
$tree -> ("Var" tree from $tree.source with $tree.1)
upgrade action (log base $b of $n) to "6.14" as (log $n base $b)
upgrade action "use" to "6.14" via
@@ -36,4 +36,4 @@ upgrade action "use" to "6.14" via
$path = $tree.2.1
$path = ($path, with "%.nom$" -> "")
$path = ($path, with "^lib/" -> "")
- return ("Action" tree with "use" ("Text" tree from $tree.2.source with $path)) \ No newline at end of file
+ return `(use `("Text" tree from $tree.2.source with $path))
diff --git a/lib/compatibility/compatibility.nom b/lib/compatibility/compatibility.nom
index 5ae261f..83eb3cd 100644
--- a/lib/compatibility/compatibility.nom
+++ b/lib/compatibility/compatibility.nom
@@ -22,7 +22,7 @@ external:
(upgrade action $actions to $version as $body) compiles to:
if ($actions is "Action" syntax tree):
- $actions = ("List" tree with $actions)
+ $actions = `[`$actions]
$lua = (Lua "")
for $action in $actions:
$replacements = {}
diff --git a/lib/core/control_flow.nom b/lib/core/control_flow.nom
index 481507f..1329cc8 100644
--- a/lib/core/control_flow.nom
+++ b/lib/core/control_flow.nom
@@ -232,18 +232,18 @@ test:
if ($body, contains `(do next)):
$lua, add "\n ::continue::"
- if ($key and ($body, contains ("Action" tree with "do" "next" $key))):
- $lua, add "\n " (("Action" tree with "---" "next" $key "---") as lua)
+ if ($key and ($body, contains `(do next `$key))):
+ $lua, add "\n " (`(---next `$key ---) as lua)
- if ($body, contains ("Action" tree with "do" "next" $value)):
- $lua, add "\n " (("Action" tree with "---" "next" $value "---") as lua)
+ if ($body, contains `(do next `$value)):
+ $lua, add "\n " (`(---next `$value ---) as lua)
$lua, add "\n end"
- if ($key and ($body, contains ("Action" tree with "stop" $key))):
- $lua, add "\n " (("Action" tree with "---" "stop" $key "---") as lua)
+ if ($key and ($body, contains `(stop `$key))):
+ $lua, add "\n " (`(---stop `$key ---) as lua)
- if ($body, contains ("Action" tree with "stop" $value)):
- $lua, add "\n " (("Action" tree with "---" "stop" $value "---") as lua)
+ if ($body, contains `(stop `$value)):
+ $lua, add "\n " (`(---stop `$value ---) as lua)
$lua, add "\nend -- for-loop"
$lua, remove free vars
@@ -445,7 +445,7 @@ test:
assume ((result of: return 99) == 99)
### Inline thunk:
-(result of $body) compiles to "\(("Action" tree with "->" $body) as lua)()"
+(result of $body) compiles to "\(`(-> `$body) as lua)()"
test:
$t = [1, [2, [[3], 4], 5, [[[6]]]]]
$flat = []
@@ -474,11 +474,11 @@ test:
if ($body, contains `(do next)):
$lua, add "\n ::continue::"
- if ($body, contains ("Action" tree with "do" "next" $var)):
- $lua, add "\n \(("Action" tree with "---" "next" $var "---") as lua)"
+ if ($body, contains `(do next `$var)):
+ $lua, add "\n \(`(---next `$var ---) as lua)"
$lua, add "\n end -- Recursive loop"
- if ($body, contains ("Action" tree with "stop" $var)):
- $lua, add "\n \(("Action" tree with "---" "stop" $var "---") as lua)"
+ if ($body, contains `(stop `$var)):
+ $lua, add "\n \(`(---stop `$var ---) as lua)"
$lua, add "\nend -- Recursive scope"
return $lua
diff --git a/lib/core/things.nom b/lib/core/things.nom
index e83f88d..e6d215a 100644
--- a/lib/core/things.nom
+++ b/lib/core/things.nom
@@ -121,4 +121,4 @@ external:
")
$lua, add free vars [$class_id]
- return $lua \ No newline at end of file
+ return $lua
diff --git a/lib/shell/init.nom b/lib/shell/init.nom
index 13dc675..be72c9f 100644
--- a/lib/shell/init.nom
+++ b/lib/shell/init.nom
@@ -28,8 +28,5 @@ external:
"Command failure: Command `\($cmd)` was terminated by signal \$return"
### Attach callsite information for better error reporting
- (=sh $cmd) compiles to
- ("Action" tree with "at" ("Text" tree with "\($cmd.source)") "=" "sh" $cmd) as lua
-
- (sh> $cmd) compiles to
- ("Action" tree with "at" ("Text" tree with "\($cmd.source)") "sh" ">" $cmd) as lua \ No newline at end of file
+ (=sh $cmd) compiles to `(at `("Text" tree with "\($cmd.source)") =sh `$cmd)
+ (sh> $cmd) compiles to `(at `("Text" tree with "\($cmd.source)") sh> `$cmd)
diff --git a/lib/tools/find.nom b/lib/tools/find.nom
index 45a51e5..e3ef185 100755
--- a/lib/tools/find.nom
+++ b/lib/tools/find.nom
@@ -43,7 +43,7 @@ command line program with $args:
for $ in (1 to #$patt):
if ($patt.$ is syntax tree):
- if ($patt.$ == ("Var" tree with "multi_wildcard")): return (yes)
+ if ($patt.$ == `$multi_wildcard): return (yes)
unless ($tree.$ matches $patt.$): return (no)
..else:
unless ($tree.$ == $patt.$): return (no)
@@ -99,4 +99,4 @@ command line program with $args:
..else:
sort $results by $ -> $.line
for $ in $results:
- say $.text \ No newline at end of file
+ say $.text
diff --git a/lib/tools/tutorial.nom b/lib/tools/tutorial.nom
index 0dda917..035443e 100755
--- a/lib/tools/tutorial.nom
+++ b/lib/tools/tutorial.nom
@@ -15,10 +15,10 @@ use "shell"
")
[<your code here>, ???] all compile to
- (
- "Action" tree with "at" ("Text" tree with "\((this tree).source)") "fail"
+ `(
+ at `("Text" tree with "\((this tree).source)") fail
`"Incomplete code: This needs to be filled in."
- ) as lua
+ )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~