aboutsummaryrefslogtreecommitdiff
path: root/tools/parse.nom
diff options
context:
space:
mode:
Diffstat (limited to 'tools/parse.nom')
-rwxr-xr-xtools/parse.nom45
1 files changed, 0 insertions, 45 deletions
diff --git a/tools/parse.nom b/tools/parse.nom
deleted file mode 100755
index 22bfdc3..0000000
--- a/tools/parse.nom
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/usr/bin/env nomsu -V6.14
-#
- Tool to print out a parse tree of files in an easy-to-read format. Usage:
- nomsu tools/parse.nom file1 file2 directory1 ...
-
-use "lib/os"
-
-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
-externally (print tree $t at indent $indent) means:
- if $t.type is:
- "Action":
- say "\($indent)Action (\($t.stub)):"
- for $arg in $t:
- if ($arg is syntax tree):
- print tree $arg at indent "\$indent "
-
- "MethodCall":
- say "\($indent)MethodCall on:"
- print tree $t.1 at indent "\$indent "
- print tree $t.2 at indent "\$indent "
-
- "Number":
- say "\$indent\($t.1)"
-
- "Var":
- say "\($indent)$\($t.1)"
-
- else:
- say "\$indent\($t.type):"
- for $arg in $t:
- when:
- ($arg is syntax tree):
- print tree $arg at indent "\$indent "
-
- else:
- say "\$indent \(quote $arg)"
-
-for $filename in $(COMMAND LINE ARGS).extras:
- $file = (read file $filename)
- unless $file:
- fail "File does not exist: \$filename"
- $nomsu = (NomsuCode from (Source $filename 1 (size of $file)) $file)
- $tree = ($nomsu parsed)
- print tree $tree at indent ""