about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-08-25 18:23:52 -0700
committerKartik Agaram <vc@akkartik.com>2019-08-25 20:07:15 -0700
commitdac833572b86b391bbca0df3b21f772df769ff95 (patch)
treefdbe6840e611c7b029831008da0e7a89522aa2eb
parent300f4554910095a6c8762f625816dafae55dea98 (diff)
downloadmu-dac833572b86b391bbca0df3b21f772df769ff95.tar.gz
5585
-rwxr-xr-xntranslate11
-rwxr-xr-xtest_apps134
-rwxr-xr-xtranslate11
3 files changed, 33 insertions, 123 deletions
diff --git a/ntranslate b/ntranslate
index 24d87056..cdd5cb18 100755
--- a/ntranslate
+++ b/ntranslate
@@ -12,22 +12,23 @@
 #     Again, that's for subsequent scripts.
 
 set -e
-set -v
 
 ./build
 
-echo `cat $* |grep -v '^\s*#\|^\s*$' |wc -l` lines
-
+echo "  tests"
 cat $*          |apps/tests    > a.tests
 
+echo "  dquotes"
 cat a.tests     |apps/dquotes  > a.dquotes
 
+echo "  assort"
 cat a.dquotes   |apps/assort   > a.assort
 
+echo "  pack"
 cat a.assort    |apps/pack     > a.pack
 
+echo "  survey"
 cat a.pack      |apps/survey   > a.survey
 
+echo "  hex"
 cat a.survey    |apps/hex      > a.elf
-
-xxd a.elf                      > a.xxd
diff --git a/test_apps b/test_apps
index 91929b6d..ed7350e4 100755
--- a/test_apps
+++ b/test_apps
@@ -307,129 +307,37 @@ test `uname` = 'Linux'  &&  {
   echo
 }
 
-echo "== translating using SubX"
-
-# example programs
-
-echo ex1
-test $EMULATED  &&  {
-  cat examples/ex1.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex1 -
-}
-test $NATIVE  &&  {
-  cat examples/ex1.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex1 -
-}
-
-echo ex2
-test $EMULATED  &&  {
-  cat examples/ex2.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex2 -
-}
-test $NATIVE  &&  {
-  cat examples/ex2.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex2 -
-}
-
-echo ex3
-test $EMULATED  &&  {
-  cat examples/ex3.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex3 -
-}
-test $NATIVE  &&  {
-  cat examples/ex3.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex3 -
-}
-
-echo ex4
-test $EMULATED  &&  {
-  cat examples/ex4.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex4 -
-}
-test $NATIVE  &&  {
-  cat examples/ex4.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex4 -
-}
-
-echo ex5
-test $EMULATED  &&  {
-  cat examples/ex5.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex5 -
-}
-test $NATIVE  &&  {
-  cat examples/ex5.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex5 -
-}
-
-echo ex6
-test $EMULATED  &&  {
-  cat examples/ex6.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex6 -
-}
-test $NATIVE  &&  {
-  cat examples/ex6.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex6 -
-}
-
-echo ex7
-test $EMULATED  &&  {
-  cat examples/ex7.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex7 -
-}
-test $NATIVE  &&  {
-  cat examples/ex7.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex7 -
-}
-
-echo ex8
-test $EMULATED  &&  {
-  cat examples/ex8.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex8 -
-}
-test $NATIVE  &&  {
-  cat examples/ex8.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex8 -
-}
-
-echo ex9
-test $EMULATED  &&  {
-  cat examples/ex9.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex9 -
-}
-test $NATIVE  &&  {
-  cat examples/ex9.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex9 -
-}
-
-echo ex10
-test $EMULATED  &&  {
-  cat examples/ex10.subx |./subx_bin run apps/tests |./subx_bin run apps/dquotes |./subx_bin run apps/assort |./subx_bin run apps/pack |./subx_bin run apps/survey |./subx_bin run apps/hex |diff examples/ex10 -
-}
-test $NATIVE  &&  {
-  cat examples/ex10.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex10 -
-}
-
 # Only native runs beyond this point. Emulated runs time out on travis-ci.org.
 test $EMULATED  &&  echo "skipping remaining runs in emulated mode"
 test $NATIVE  ||  exit 0
 
-echo ex11
-cat examples/ex11.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex11 -
+echo "== translating using SubX"
 
-echo ex12
-cat examples/ex12.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff examples/ex12 -
+# example programs
+
+for n in `seq 1 12`
+do
+  echo ex$n
+  ./ntranslate examples/ex$n.subx
+  diff examples/ex$n a.elf
+done
 
 # Larger apps that use the standard library.
 
-echo factorial
-cat 0*.subx apps/factorial.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/factorial -
-echo crenshaw2-1
-cat 0*.subx apps/crenshaw2-1.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/crenshaw2-1 -
-echo crenshaw2-1b
-cat 0*.subx apps/crenshaw2-1b.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/crenshaw2-1b -
-echo handle
-cat 0*.subx apps/handle.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/handle -
+for app in factorial crenshaw2-1 crenshaw2-1b handle
+do
+  echo $app
+  ./ntranslate 0*.subx apps/$app.subx
+  diff apps/$app a.elf
+done
 
 # Phases of the self-hosted SubX translator.
 
-echo hex
-cat 0*.subx apps/subx-common.subx apps/hex.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/hex -
-echo survey
-cat 0*.subx apps/subx-common.subx apps/survey.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/survey -
-echo pack
-cat 0*.subx apps/subx-common.subx apps/pack.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/pack -
-echo assort
-cat 0*.subx apps/subx-common.subx apps/assort.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/assort -
-echo dquotes
-cat 0*.subx apps/subx-common.subx apps/dquotes.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/dquotes -
-echo tests
-cat 0*.subx apps/subx-common.subx apps/tests.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/tests -
-
-# Higher-level syntax.
-
-echo desugar
-cat 0*.subx apps/subx-common.subx apps/desugar.subx |apps/tests |apps/dquotes |apps/assort |apps/pack |apps/survey |apps/hex |diff apps/desugar -
+for app in hex survey pack assort dquotes tests desugar
+do
+  echo $app
+  ./ntranslate 0*.subx apps/subx-common.subx apps/$app.subx
+  diff apps/$app a.elf
+done
 
 exit 0
diff --git a/translate b/translate
index 7acf92c4..a3acacc6 100755
--- a/translate
+++ b/translate
@@ -12,22 +12,23 @@
 #     Again, that's for subsequent scripts.
 
 set -e
-set -v
 
 ./build
 
-echo `cat $* |grep -v '^\s*#\|^\s*$' |wc -l` lines
-
+echo "  tests"
 cat $*          |./subx_bin run apps/tests    > a.tests
 
+echo "  dquotes"
 cat a.tests     |./subx_bin run apps/dquotes  > a.dquotes
 
+echo "  assort"
 cat a.dquotes   |./subx_bin run apps/assort   > a.assort
 
+echo "  pack"
 cat a.assort    |./subx_bin run apps/pack     > a.pack
 
+echo "  survey"
 cat a.pack      |./subx_bin run apps/survey   > a.survey
 
+echo "  hex"
 cat a.survey    |./subx_bin run apps/hex      > a.elf
-
-xxd a.elf                                     > a.xxd