Improve 1996/august/try.sh

This commit is contained in:
Cody Boone Ferguson committed 2024-01-18 11:22:22 -08:00
1 parent 8cfd3f67e5
commit 5402b8f1da
3 files changed
+52 -7

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@ The above should print a `!` followed by a newline.
## Judges' remarks: ## Judges' remarks:
This entry can feed on itself. If you C pre-process the source, This entry can feed on itself. If you C pre-process the source,
you compile the interpreter: you can compile the interpreter:
```sh ```sh
make august.oc make august.oc
+49 -4
View File
@@ -15,26 +15,71 @@ make CC="$CC" all >/dev/null || exit 1
# clear screen after compilation so that only the entry is shown # clear screen after compilation so that only the entry is shown
clear clear
set -x read -r -n 1 -p "Press any key to run: cat august.c test.oc | ./august > test.oo: "
echo 1>&2
cat august.c test.oc | ./august > test.oo cat august.c test.oc | ./august > test.oo
echo 1>&2
read -r -n 1 -p "Press any key to run: ./august < test.oo: "
echo 1>&2
./august < test.oo ./august < test.oo
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.c fac.oc | ./august > fac.oo: "
echo 1>&2
cat august.c fac.oc | ./august > fac.oo cat august.c fac.oc | ./august > fac.oo
echo 1>&2
read -r -n 1 -p "Press any key to run: ./august < fac.oo: "
echo 1>&2
./august < fac.oo ./august < fac.oo
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.c fac.oc | ./august | ./august: "
echo 1>&2
cat august.c fac.oc | ./august | ./august cat august.c fac.oc | ./august | ./august
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.c parse.oc | ./august > parse.oo: "
echo 1>&2
cat august.c parse.oc | ./august > parse.oo cat august.c parse.oc | ./august > parse.oo
cat parse.oo fac.oc | ./august | ./august echo 1>&2
rm august.oc read -r -n 1 -p "Press any key to run: cat parse.oo fac.oc | ./august | ./august: "
make august.oc echo 1>&2
cat parse.oo fac.oc | ./august | ./august
echo 1>&2
read -r -n 1 -p "Press any key to run: rm august.oc; make august.oc: "
echo 1>&2
rm august.oc; make august.oc
echo 1>&2
# this next step is vital for some compilers! Not having it will make the # this next step is vital for some compilers! Not having it will make the
# compiler create code that enters an infinite loop. This is known to happen in # compiler create code that enters an infinite loop. This is known to happen in
# macOS as one example. # macOS as one example.
read -r -n 1 -p "Press any key to run: sed -i'' '/^#/d' august.oc: "
echo 1>&2
sed -i'' '/^#/d' august.oc sed -i'' '/^#/d' august.oc
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.c august.oc | ./august > august.oo: "
echo 1>&2
cat august.c august.oc | ./august > august.oo cat august.c august.oc | ./august > august.oo
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.oo test.oo | ./august: "
echo 1>&2
cat august.oo test.oo | ./august cat august.oo test.oo | ./august
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.oo august.oo fac.oo | ./august: "
echo 1>&2
cat august.oo august.oo fac.oo | ./august cat august.oo august.oo fac.oo | ./august
echo 1>&2
read -r -n 1 -p "Press any key to run: cat august.oo august.oo august.oo fac.oo | ./august: "
echo 1>&2
echo "This step may take more time: " 1>&2
cat august.oo august.oo august.oo fac.oo | ./august cat august.oo august.oo august.oo fac.oo | ./august
echo 1>&2
+2 -2
View File
@@ -2099,8 +2099,8 @@ Cody also added the [try.sh](/1995/vanschnitz/try.sh) script.
also fixed an infinite loop in the try commands. The problem with the infinite also fixed an infinite loop in the try commands. The problem with the infinite
loop is that the file `august.oc` had to have lines starting with `#` removed loop is that the file `august.oc` had to have lines starting with `#` removed
and it was not being done. After this is done with say `sed(/1)` (like `sed -i'' and it was not being done. After this is done with say `sed(/1)` (like `sed -i''
'/^#/d' august.oc` which has been added to both the remarks and the try.sh '/^#/d' august.oc` which has been added to both the remarks and the `try.sh`
script as described below) the code can proceed. This problem existed in macOS. script noted below) the code can proceed. This problem existed in macOS.
Cody also added the [try.sh](/1996/august/try.sh) script that runs all the Cody also added the [try.sh](/1996/august/try.sh) script that runs all the
commands given in the try section to simplify it as there are quite a lot of commands given in the try section to simplify it as there are quite a lot of