diff options
Diffstat (limited to 'linux')
-rw-r--r-- | linux/README.md | 8 | ||||
-rw-r--r-- | linux/apps/advent2017/1a.mu (renamed from linux/advent2017/1a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/1a.mu (renamed from linux/advent2020/1a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/1b.mu (renamed from linux/advent2020/1b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/2a.mu (renamed from linux/advent2020/2a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/2b.mu (renamed from linux/advent2020/2b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/3a.mu (renamed from linux/advent2020/3a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/3b.mu (renamed from linux/advent2020/3b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/4a.mu (renamed from linux/advent2020/4a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/4b.mu (renamed from linux/advent2020/4b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/5a.mu (renamed from linux/advent2020/5a.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/5b.mu (renamed from linux/advent2020/5b.mu) | 2 | ||||
-rw-r--r-- | linux/apps/advent2020/vimrc.vim (renamed from linux/advent2020/vimrc.vim) | 0 | ||||
-rw-r--r-- | linux/apps/arith.mu (renamed from linux/arith.mu) | 2 | ||||
-rw-r--r-- | linux/apps/crenshaw2-1.subx (renamed from linux/crenshaw2-1.subx) | 2 | ||||
-rw-r--r-- | linux/apps/crenshaw2-1b.subx (renamed from linux/crenshaw2-1b.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex1.mu (renamed from linux/ex1.mu) | 4 | ||||
-rw-r--r-- | linux/apps/ex1.subx | 20 | ||||
-rw-r--r-- | linux/apps/ex10.subx (renamed from linux/ex10.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex11.subx (renamed from linux/ex11.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex12.subx (renamed from linux/ex12.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex13.subx (renamed from linux/ex13.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex14.subx (renamed from linux/ex14.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex2.mu (renamed from linux/ex2.mu) | 2 | ||||
-rw-r--r-- | linux/apps/ex2.subx (renamed from linux/ex2.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex3.2.mu (renamed from linux/ex3.2.mu) | 2 | ||||
-rw-r--r-- | linux/apps/ex3.mu (renamed from linux/ex3.mu) | 2 | ||||
-rw-r--r-- | linux/apps/ex3.subx (renamed from linux/ex3.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex4.subx (renamed from linux/ex4.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex5.subx (renamed from linux/ex5.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex6.subx (renamed from linux/ex6.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex7.subx (renamed from linux/ex7.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex8.subx (renamed from linux/ex8.subx) | 2 | ||||
-rw-r--r-- | linux/apps/ex9.subx (renamed from linux/ex9.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial.mu (renamed from linux/factorial.mu) | 2 | ||||
-rw-r--r-- | linux/apps/factorial.subx (renamed from linux/factorial.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial2.subx (renamed from linux/factorial2.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial3.subx (renamed from linux/factorial3.subx) | 2 | ||||
-rw-r--r-- | linux/apps/factorial4.subx (renamed from linux/factorial4.subx) | 2 | ||||
-rw-r--r-- | linux/apps/hello.mu (renamed from linux/hello.mu) | 2 | ||||
-rw-r--r-- | linux/apps/parse-int.mu (renamed from linux/parse-int.mu) | 2 | ||||
-rw-r--r-- | linux/apps/print-file.mu (renamed from linux/print-file.mu) | 2 | ||||
-rw-r--r-- | linux/apps/raytracing/1.cc (renamed from linux/raytracing/1.cc) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/1.cc.0 (renamed from linux/raytracing/1.cc.0) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/1.mu (renamed from linux/raytracing/1.mu) | 4 | ||||
-rw-r--r-- | linux/apps/raytracing/1.ppm (renamed from linux/raytracing/1.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/2.mu (renamed from linux/raytracing/2.mu) | 4 | ||||
-rw-r--r-- | linux/apps/raytracing/2.ppm (renamed from linux/raytracing/2.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/3.expected.ppm (renamed from linux/raytracing/3.expected.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/3.mu (renamed from linux/raytracing/3.mu) | 4 | ||||
-rw-r--r-- | linux/apps/raytracing/3.ppm (renamed from linux/raytracing/3.ppm) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/README.md (renamed from linux/raytracing/README.md) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/color.h (renamed from linux/raytracing/color.h) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/color.mu (renamed from linux/raytracing/color.mu) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/main.cc (renamed from linux/raytracing/main.cc) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/ray.h (renamed from linux/raytracing/ray.h) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/ray.mu (renamed from linux/raytracing/ray.mu) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/vec.mu (renamed from linux/raytracing/vec.mu) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/vec3.h (renamed from linux/raytracing/vec3.h) | 0 | ||||
-rw-r--r-- | linux/apps/raytracing/vimrc.vim (renamed from linux/raytracing/vimrc.vim) | 0 | ||||
-rw-r--r-- | linux/apps/rpn.mu (renamed from linux/rpn.mu) | 2 | ||||
-rw-r--r-- | linux/apps/texture.mu (renamed from linux/texture.mu) | 2 | ||||
-rw-r--r-- | linux/apps/tui.mu (renamed from linux/tui.mu) | 2 | ||||
-rwxr-xr-x | linux/bootstrap/build | 2 | ||||
-rw-r--r-- | linux/ex1.subx | 18 |
65 files changed, 75 insertions, 71 deletions
diff --git a/linux/README.md b/linux/README.md index 8b81a386..0b8bc6fb 100644 --- a/linux/README.md +++ b/linux/README.md @@ -3,7 +3,7 @@ kernel. To run programs under this directory, you must first `cd` into it. ```sh $ cd linux/ - $ ./translate hello.mu # generates a.elf + $ ./translate apps/hello.mu # generates a.elf $ ./a.elf Hello world! ``` @@ -22,11 +22,11 @@ Some programs to try out: * `browse`: [A text-mode browser for a tiny subset of Markdown](https://mastodon.social/@akkartik/104845344081779025). -* `ex*`: small stand-alone examples that don't need any of the shared code at +* `apps/ex*`: small stand-alone examples that don't need any of the shared code at the top-level. They each have a simple pedagogical goal. Read these first. -* `factorial*`: A simple program to compute factorials in 5 versions, showing - all the different syntax sugars and what they expand to. +* `apps/factorial*`: A simple program to compute factorials in 5 versions, + showing all the different syntax sugars and what they expand to. The Mu compiler toolchain is also here in the following phases: diff --git a/linux/advent2017/1a.mu b/linux/apps/advent2017/1a.mu index 2f639080..aae12989 100644 --- a/linux/advent2017/1a.mu +++ b/linux/apps/advent2017/1a.mu @@ -7,7 +7,7 @@ # To build on Linux: # $ git clone https://github.com/akkartik/mu # $ cd mu/linux -# $ ./translate advent2017/1a.mu # emits a.elf +# $ ./translate apps/advent2017/1a.mu # emits a.elf # To run on Linux: # Download https://adventofcode.com/2017/day/1/input # $ ./a.elf < input diff --git a/linux/advent2020/1a.mu b/linux/apps/advent2020/1a.mu index 886329f1..da71340a 100644 --- a/linux/advent2020/1a.mu +++ b/linux/apps/advent2020/1a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/1a.mu +# $ ./translate apps/advent2020/1a.mu # $ ./a.elf < input # found # 1353 667 diff --git a/linux/advent2020/1b.mu b/linux/apps/advent2020/1b.mu index bfdbe47c..a99709b8 100644 --- a/linux/advent2020/1b.mu +++ b/linux/apps/advent2020/1b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/1b.mu +# $ ./translate apps/advent2020/1b.mu # $ ./a.elf < input # found # 143 407 1470 diff --git a/linux/advent2020/2a.mu b/linux/apps/advent2020/2a.mu index ce678eb8..44d50d46 100644 --- a/linux/advent2020/2a.mu +++ b/linux/apps/advent2020/2a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/2a.mu +# $ ./translate apps/advent2020/2a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/2b.mu b/linux/apps/advent2020/2b.mu index 121e9dfa..d0d23998 100644 --- a/linux/advent2020/2b.mu +++ b/linux/apps/advent2020/2b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/2b.mu +# $ ./translate apps/advent2020/2b.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/3a.mu b/linux/apps/advent2020/3a.mu index d2dfc15e..6f95ddf1 100644 --- a/linux/advent2020/3a.mu +++ b/linux/apps/advent2020/3a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/3a.mu +# $ ./translate apps/advent2020/3a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/3b.mu b/linux/apps/advent2020/3b.mu index 7db91eea..8a4f442d 100644 --- a/linux/advent2020/3b.mu +++ b/linux/apps/advent2020/3b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/3a.mu +# $ ./translate apps/advent2020/3a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/4a.mu b/linux/apps/advent2020/4a.mu index 1b16712d..2efe475a 100644 --- a/linux/advent2020/4a.mu +++ b/linux/apps/advent2020/4a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/4a.mu +# $ ./translate apps/advent2020/4a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/4b.mu b/linux/apps/advent2020/4b.mu index 2dc6c6a2..e92e96e4 100644 --- a/linux/advent2020/4b.mu +++ b/linux/apps/advent2020/4b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/4b.mu +# $ ./translate apps/advent2020/4b.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/5a.mu b/linux/apps/advent2020/5a.mu index 19d342c4..34e2e113 100644 --- a/linux/advent2020/5a.mu +++ b/linux/apps/advent2020/5a.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/5a.mu +# $ ./translate apps/advent2020/5a.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/5b.mu b/linux/apps/advent2020/5b.mu index e6a3520f..197ea885 100644 --- a/linux/advent2020/5b.mu +++ b/linux/apps/advent2020/5b.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate advent2020/5b.mu +# $ ./translate apps/advent2020/5b.mu # $ ./a.elf < input # # You'll need to register to download the 'input' file for yourself. diff --git a/linux/advent2020/vimrc.vim b/linux/apps/advent2020/vimrc.vim index 348fe364..348fe364 100644 --- a/linux/advent2020/vimrc.vim +++ b/linux/apps/advent2020/vimrc.vim diff --git a/linux/arith.mu b/linux/apps/arith.mu index 5a9d5032..4393a34c 100644 --- a/linux/arith.mu +++ b/linux/apps/arith.mu @@ -7,7 +7,7 @@ # No division yet. # # To build: -# $ ./translate arith.mu +# $ ./translate apps/arith.mu # # Example session: # $ ./a.elf diff --git a/linux/crenshaw2-1.subx b/linux/apps/crenshaw2-1.subx index ade0399a..73c0f16e 100644 --- a/linux/crenshaw2-1.subx +++ b/linux/apps/crenshaw2-1.subx @@ -3,7 +3,7 @@ # except that we support hex digits. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx crenshaw2-1.subx -o crenshaw2-1 +# $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1.subx -o crenshaw2-1 # $ echo '3' |bootstrap/bootstrap run crenshaw2-1 # Expected output: # # syscall(exit, 3) diff --git a/linux/crenshaw2-1b.subx b/linux/apps/crenshaw2-1b.subx index d5b8194e..033c69c5 100644 --- a/linux/crenshaw2-1b.subx +++ b/linux/apps/crenshaw2-1b.subx @@ -3,7 +3,7 @@ # except that we support hex numbers of multiple digits. # # To run: -# $ bootstrap/bootstrap translate [01]*.subx crenshaw2-1b.subx -o crenshaw2-1b +# $ bootstrap/bootstrap translate [01]*.subx apps/crenshaw2-1b.subx -o crenshaw2-1b # $ echo '1a' |bootstrap/bootstrap run crenshaw2-1b # Expected output: # # syscall(exit, 1a) diff --git a/linux/ex1.mu b/linux/apps/ex1.mu index fbf38d0c..36304803 100644 --- a/linux/ex1.mu +++ b/linux/apps/ex1.mu @@ -1,8 +1,10 @@ # First example: return the answer to the Ultimate Question of Life, the # Universe, and Everything. # +# Same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html +# # To run: -# $ ./translate ex1.mu +# $ ./translate apps/ex1.mu # $ ./a.elf # Expected result: # $ echo $? diff --git a/linux/apps/ex1.subx b/linux/apps/ex1.subx new file mode 100644 index 00000000..0406dbe8 --- /dev/null +++ b/linux/apps/ex1.subx @@ -0,0 +1,20 @@ +# First example: return the answer to the Ultimate Question of Life, the +# Universe, and Everything. +# +# Same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html +# +# To run: +# $ bootstrap/bootstrap translate apps/ex1.subx -o ex1 +# $ bootstrap/bootstrap run ex1 +# Expected result: +# $ echo $? +# 42 + +== code + +Entry: +# exit(42) +bb/copy-to-ebx 0x2a/imm32 # 42 in hex +e8/call syscall_exit/disp32 + +# . . vim:nowrap:textwidth=0 diff --git a/linux/ex10.subx b/linux/apps/ex10.subx index 2be53012..c4ce7e2d 100644 --- a/linux/ex10.subx +++ b/linux/apps/ex10.subx @@ -1,7 +1,7 @@ # String comparison: return 1 iff the two args passed in at the commandline are equal. # # To run: -# $ bootstrap/bootstrap translate ex10.subx -o ex10 +# $ bootstrap/bootstrap translate apps/ex10.subx -o ex10 # $ bootstrap/bootstrap run ex10 abc abd # Expected result: # $ echo $? diff --git a/linux/ex11.subx b/linux/apps/ex11.subx index d8596b8e..0ec5cc1a 100644 --- a/linux/ex11.subx +++ b/linux/apps/ex11.subx @@ -6,7 +6,7 @@ # a null-terminated 'kernel string' with a size-prefixed 'SubX string'. # # To run: -# $ bootstrap/bootstrap translate ex11.subx -o ex11 +# $ bootstrap/bootstrap translate apps/ex11.subx -o ex11 # $ bootstrap/bootstrap run ex11 # runs a series of tests # ...... # all tests pass # diff --git a/linux/ex12.subx b/linux/apps/ex12.subx index 4f1617a7..476d8cda 100644 --- a/linux/ex12.subx +++ b/linux/apps/ex12.subx @@ -2,7 +2,7 @@ # Create a new segment using mmap, save the address, write to it. # # To run: -# $ bootstrap/bootstrap translate ex12.subx -o ex12 +# $ bootstrap/bootstrap translate apps/ex12.subx -o ex12 # $ bootstrap/bootstrap run ex12 # You shouldn't get a segmentation fault. diff --git a/linux/ex13.subx b/linux/apps/ex13.subx index 862bf897..56028a05 100644 --- a/linux/ex13.subx +++ b/linux/apps/ex13.subx @@ -1,7 +1,7 @@ # Compare 3 and 3. # # To run: -# $ bootstrap/bootstrap translate ex13.subx -o ex13 +# $ bootstrap/bootstrap translate apps/ex13.subx -o ex13 # $ bootstrap/bootstrap run ex13 # Expected result: # $ echo $? diff --git a/linux/ex14.subx b/linux/apps/ex14.subx index 531bae7a..70aa8629 100644 --- a/linux/ex14.subx +++ b/linux/apps/ex14.subx @@ -1,7 +1,7 @@ # Multiply 2 numbers. # # To run: -# $ bootstrap/bootstrap translate ex14.subx -o ex14 +# $ bootstrap/bootstrap translate apps/ex14.subx -o ex14 # $ bootstrap/bootstrap run ex14 # Expected result: # $ echo $? diff --git a/linux/ex2.mu b/linux/apps/ex2.mu index 21dee1df..b3b74613 100644 --- a/linux/ex2.mu +++ b/linux/apps/ex2.mu @@ -1,7 +1,7 @@ # Add 3 and 4, and return the result in the exit code. # # To run: -# $ ./translate ex2.mu +# $ ./translate apps/ex2.mu # $ ./a.elf # Expected result: # $ echo $? diff --git a/linux/ex2.subx b/linux/apps/ex2.subx index 5ca39872..40955104 100644 --- a/linux/ex2.subx +++ b/linux/apps/ex2.subx @@ -1,7 +1,7 @@ # Add 3 and 4, and return the result in the exit code. # # To run: -# $ bootstrap/bootstrap translate ex2.subx -o ex2 +# $ bootstrap/bootstrap translate apps/ex2.subx -o ex2 # $ bootstrap/bootstrap run ex2 # Expected result: # $ echo $? diff --git a/linux/ex3.2.mu b/linux/apps/ex3.2.mu index 8ca6c992..c5992963 100644 --- a/linux/ex3.2.mu +++ b/linux/apps/ex3.2.mu @@ -1,7 +1,7 @@ # Unnecessarily use an array to sum 1..10 # # To run: -# $ ./translate ex3.2.mu +# $ ./translate apps/ex3.2.mu # $ ./a.elf # $ echo $? # 55 diff --git a/linux/ex3.mu b/linux/apps/ex3.mu index f96fd099..4ae3e93d 100644 --- a/linux/ex3.mu +++ b/linux/apps/ex3.mu @@ -1,7 +1,7 @@ # Add the first 10 numbers, and return the result in the exit code. # # To run: -# $ ./translate browse.mu +# $ ./translate ex3.mu # $ ./a.elf # Expected result: # $ echo $? diff --git a/linux/ex3.subx b/linux/apps/ex3.subx index 5b74d76c..f4b5fed7 100644 --- a/linux/ex3.subx +++ b/linux/apps/ex3.subx @@ -1,7 +1,7 @@ # Add the first 10 numbers, and return the result in the exit code. # # To run: -# $ bootstrap/bootstrap translate ex3.subx -o ex3 +# $ bootstrap/bootstrap translate apps/ex3.subx -o ex3 # $ bootstrap/bootstrap run ex3 # Expected result: # $ echo $? diff --git a/linux/ex4.subx b/linux/apps/ex4.subx index ee78ce7d..3bf62551 100644 --- a/linux/ex4.subx +++ b/linux/apps/ex4.subx @@ -1,7 +1,7 @@ # Read a character from stdin, save it to a global, write it to stdout. # # To run: -# $ bootstrap/bootstrap translate ex4.subx -o ex4 +# $ bootstrap/bootstrap translate apps/ex4.subx -o ex4 # $ bootstrap/bootstrap run ex4 == data diff --git a/linux/ex5.subx b/linux/apps/ex5.subx index e8957ea7..220a4246 100644 --- a/linux/ex5.subx +++ b/linux/apps/ex5.subx @@ -1,7 +1,7 @@ # Read a character from stdin, save it to a local on the stack, write it to stdout. # # To run: -# $ bootstrap/bootstrap translate ex5.subx -o ex5 +# $ bootstrap/bootstrap translate apps/ex5.subx -o ex5 # $ bootstrap/bootstrap run ex5 == code diff --git a/linux/ex6.subx b/linux/apps/ex6.subx index 5715e94f..cf6309e6 100644 --- a/linux/ex6.subx +++ b/linux/apps/ex6.subx @@ -1,7 +1,7 @@ # Print out a (global variable) string to stdout. # # To run: -# $ bootstrap/bootstrap translate ex6.subx -o ex6 +# $ bootstrap/bootstrap translate apps/ex6.subx -o ex6 # $ bootstrap/bootstrap run ex6 # Hello, world! diff --git a/linux/ex7.subx b/linux/apps/ex7.subx index ad1a50b6..c14fc19d 100644 --- a/linux/ex7.subx +++ b/linux/apps/ex7.subx @@ -5,7 +5,7 @@ # the character read. # # To run: -# $ bootstrap/bootstrap translate ex7.subx -o ex7 +# $ bootstrap/bootstrap translate apps/ex7.subx -o ex7 # $ bootstrap/bootstrap run ex7 # Expected result: # $ echo $? diff --git a/linux/ex8.subx b/linux/apps/ex8.subx index 909d1adb..2d962be4 100644 --- a/linux/ex8.subx +++ b/linux/apps/ex8.subx @@ -1,7 +1,7 @@ # Example reading commandline arguments: compute length of first arg. # # To run: -# $ bootstrap/bootstrap translate ex8.subx -o ex8 +# $ bootstrap/bootstrap translate apps/ex8.subx -o ex8 # $ bootstrap/bootstrap run ex8 abc de fghi # Expected result: # $ echo $? diff --git a/linux/ex9.subx b/linux/apps/ex9.subx index cbab3aa9..27520191 100644 --- a/linux/ex9.subx +++ b/linux/apps/ex9.subx @@ -4,7 +4,7 @@ # letter of second arg. # # To run: -# $ bootstrap/bootstrap translate ex9.subx -o ex9 +# $ bootstrap/bootstrap translate apps/ex9.subx -o ex9 # $ bootstrap/bootstrap run ex9 z x # Expected result: # $ echo $? diff --git a/linux/factorial.mu b/linux/apps/factorial.mu index 7eccc1ec..959d3bc0 100644 --- a/linux/factorial.mu +++ b/linux/apps/factorial.mu @@ -1,7 +1,7 @@ # compute the factorial of 5, and return the result in the exit code # # To run: -# $ ./translate factorial.mu +# $ ./translate apps/factorial.mu # $ ./a.elf # $ echo $? # 120 diff --git a/linux/factorial.subx b/linux/apps/factorial.subx index 1bcc0a9d..e36f892d 100644 --- a/linux/factorial.subx +++ b/linux/apps/factorial.subx @@ -1,7 +1,7 @@ ## compute the factorial of 5, and print the result # # To run: -# $ bootstrap/bootstrap translate [01]*.subx factorial.subx -o factorial +# $ bootstrap/bootstrap translate [01]*.subx apps/factorial.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial2.subx b/linux/apps/factorial2.subx index 16af9008..95450b3a 100644 --- a/linux/factorial2.subx +++ b/linux/apps/factorial2.subx @@ -4,7 +4,7 @@ # rm32 operands # # To run: -# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial +# $ ./translate_subx init.linux [01]*.subx apps/factorial2.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial3.subx b/linux/apps/factorial3.subx index 72b76963..deb30377 100644 --- a/linux/factorial3.subx +++ b/linux/apps/factorial3.subx @@ -5,7 +5,7 @@ # function calls # # To run: -# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial +# $ ./translate_subx init.linux [01]*.subx apps/factorial3.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/factorial4.subx b/linux/apps/factorial4.subx index 219fce41..0707cfdd 100644 --- a/linux/factorial4.subx +++ b/linux/apps/factorial4.subx @@ -6,7 +6,7 @@ # control flow # # To run: -# $ ./translate_subx init.linux [01]*.subx factorial.subx -o factorial +# $ ./translate_subx init.linux [01]*.subx apps/factorial4.subx -o factorial # $ bootstrap/bootstrap run factorial # Expected result: # $ echo $? diff --git a/linux/hello.mu b/linux/apps/hello.mu index ac280b8a..debdf916 100644 --- a/linux/hello.mu +++ b/linux/apps/hello.mu @@ -1,7 +1,7 @@ # Meaningless conventional example. # # To run: -# $ ./translate hello.mu +# $ ./translate apps/hello.mu # $ ./a.elf fn main -> _/ebx: int { diff --git a/linux/parse-int.mu b/linux/apps/parse-int.mu index 8f572784..0f8c71d1 100644 --- a/linux/parse-int.mu +++ b/linux/apps/parse-int.mu @@ -1,7 +1,7 @@ # parse a decimal int at the commandline # # To run: -# $ ./translate parse-int.mu +# $ ./translate apps/parse-int.mu # $ ./a.elf 123 # $ echo $? # 123 diff --git a/linux/print-file.mu b/linux/apps/print-file.mu index 6dded6ba..75ce2e39 100644 --- a/linux/print-file.mu +++ b/linux/apps/print-file.mu @@ -2,7 +2,7 @@ # only ascii right now, just like the rest of Mu # # To run: -# $ ./translate print-file.mu +# $ ./translate apps/print-file.mu # $ echo abc > x # $ ./a.elf x # abc diff --git a/linux/raytracing/1.cc b/linux/apps/raytracing/1.cc index 254f531c..254f531c 100644 --- a/linux/raytracing/1.cc +++ b/linux/apps/raytracing/1.cc diff --git a/linux/raytracing/1.cc.0 b/linux/apps/raytracing/1.cc.0 index 13d5a1b6..13d5a1b6 100644 --- a/linux/raytracing/1.cc.0 +++ b/linux/apps/raytracing/1.cc.0 diff --git a/linux/raytracing/1.mu b/linux/apps/raytracing/1.mu index 8c92710f..dfb4ec13 100644 --- a/linux/raytracing/1.mu +++ b/linux/apps/raytracing/1.mu @@ -3,8 +3,8 @@ # # To run (on Linux): # $ git clone https://github.com/akkartik/mu -# $ cd mu -# $ ./translate raytracing/1.mu +# $ cd mu/linux +# $ ./translate apps/raytracing/1.mu # $ ./a.elf > 1.ppm fn main -> _/ebx: int { diff --git a/linux/raytracing/1.ppm b/linux/apps/raytracing/1.ppm index 902cc97f..902cc97f 100644 --- a/linux/raytracing/1.ppm +++ b/linux/apps/raytracing/1.ppm diff --git a/linux/raytracing/2.mu b/linux/apps/raytracing/2.mu index 7de89518..92e457d3 100644 --- a/linux/raytracing/2.mu +++ b/linux/apps/raytracing/2.mu @@ -2,8 +2,8 @@ # # To run (on Linux): # $ git clone https://github.com/akkartik/mu -# $ cd mu -# $ ./translate raytracing/2.mu +# $ cd mu/linux +# $ ./translate apps/raytracing/2.mu # $ ./a.elf > 2.ppm fn main -> _/ebx: int { diff --git a/linux/raytracing/2.ppm b/linux/apps/raytracing/2.ppm index 902cc97f..902cc97f 100644 --- a/linux/raytracing/2.ppm +++ b/linux/apps/raytracing/2.ppm diff --git a/linux/raytracing/3.expected.ppm b/linux/apps/raytracing/3.expected.ppm index 6d5b91ca..6d5b91ca 100644 --- a/linux/raytracing/3.expected.ppm +++ b/linux/apps/raytracing/3.expected.ppm diff --git a/linux/raytracing/3.mu b/linux/apps/raytracing/3.mu index c64ea035..beb37136 100644 --- a/linux/raytracing/3.mu +++ b/linux/apps/raytracing/3.mu @@ -2,8 +2,8 @@ # # To run (on Linux): # $ git clone https://github.com/akkartik/mu -# $ cd mu -# $ ./translate raytracing/3.mu +# $ cd mu/linux +# $ ./translate apps/raytracing/3.mu # $ ./a.elf > 3.ppm fn ray-color _in: (addr ray), _out: (addr rgb) { diff --git a/linux/raytracing/3.ppm b/linux/apps/raytracing/3.ppm index 6d5b91ca..6d5b91ca 100644 --- a/linux/raytracing/3.ppm +++ b/linux/apps/raytracing/3.ppm diff --git a/linux/raytracing/README.md b/linux/apps/raytracing/README.md index cc31c1af..cc31c1af 100644 --- a/linux/raytracing/README.md +++ b/linux/apps/raytracing/README.md diff --git a/linux/raytracing/color.h b/linux/apps/raytracing/color.h index a8a34b26..a8a34b26 100644 --- a/linux/raytracing/color.h +++ b/linux/apps/raytracing/color.h diff --git a/linux/raytracing/color.mu b/linux/apps/raytracing/color.mu index 86b3d0b6..86b3d0b6 100644 --- a/linux/raytracing/color.mu +++ b/linux/apps/raytracing/color.mu diff --git a/linux/raytracing/main.cc b/linux/apps/raytracing/main.cc index 35177279..35177279 100644 --- a/linux/raytracing/main.cc +++ b/linux/apps/raytracing/main.cc diff --git a/linux/raytracing/ray.h b/linux/apps/raytracing/ray.h index ed65168a..ed65168a 100644 --- a/linux/raytracing/ray.h +++ b/linux/apps/raytracing/ray.h diff --git a/linux/raytracing/ray.mu b/linux/apps/raytracing/ray.mu index 20cc42e9..20cc42e9 100644 --- a/linux/raytracing/ray.mu +++ b/linux/apps/raytracing/ray.mu diff --git a/linux/raytracing/vec.mu b/linux/apps/raytracing/vec.mu index 7caf7e88..7caf7e88 100644 --- a/linux/raytracing/vec.mu +++ b/linux/apps/raytracing/vec.mu diff --git a/linux/raytracing/vec3.h b/linux/apps/raytracing/vec3.h index d8341d36..d8341d36 100644 --- a/linux/raytracing/vec3.h +++ b/linux/apps/raytracing/vec3.h diff --git a/linux/raytracing/vimrc.vim b/linux/apps/raytracing/vimrc.vim index 348fe364..348fe364 100644 --- a/linux/raytracing/vimrc.vim +++ b/linux/apps/raytracing/vimrc.vim diff --git a/linux/rpn.mu b/linux/apps/rpn.mu index f849e05d..28132470 100644 --- a/linux/rpn.mu +++ b/linux/apps/rpn.mu @@ -4,7 +4,7 @@ # No division yet. # # To build: -# $ ./translate rpn.mu +# $ ./translate apps/rpn.mu # # Example session: # $ ./a.elf diff --git a/linux/texture.mu b/linux/apps/texture.mu index 8178424b..038a9790 100644 --- a/linux/texture.mu +++ b/linux/apps/texture.mu @@ -3,7 +3,7 @@ # To run (on Linux): # $ git clone https://github.com/akkartik/mu # $ cd mu -# $ ./translate texture.mu +# $ ./translate apps/texture.mu # $ ./a.elf > a.ppm fn main -> _/ebx: int { diff --git a/linux/tui.mu b/linux/apps/tui.mu index b34c3e0a..4e58b986 100644 --- a/linux/tui.mu +++ b/linux/apps/tui.mu @@ -1,7 +1,7 @@ # Test some primitives for text-mode. # # To run: -# $ ./translate tui.mu +# $ ./translate apps/tui.mu # $ ./a.elf fn main -> _/ebx: int { diff --git a/linux/bootstrap/build b/linux/bootstrap/build index de5b432d..ee4b5546 100755 --- a/linux/bootstrap/build +++ b/linux/bootstrap/build @@ -99,7 +99,7 @@ grep -h "^\s*void test_" bootstrap.cc |sed 's/^\s*void \(.*\)() {.*/"\1",/' |u older_than bootstrap_bin bootstrap.cc *_list && { $CXX $CXXFLAGS bootstrap.cc -o bootstrap_bin - echo + echo >&2 } exit 0 diff --git a/linux/ex1.subx b/linux/ex1.subx deleted file mode 100644 index 183c014a..00000000 --- a/linux/ex1.subx +++ /dev/null @@ -1,18 +0,0 @@ -# First program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html -# Just return 42. -# -# To run: -# $ bootstrap/bootstrap translate ex1.subx -o ex1 -# $ bootstrap/bootstrap run ex1 -# Expected result: -# $ echo $? -# 42 - -== code - -Entry: -# exit(42) -bb/copy-to-ebx 0x2a/imm32 # 42 in hex -e8/call syscall_exit/disp32 - -# . . vim:nowrap:textwidth=0 |