This commit is contained in:
Kartik Agaram 2019-07-31 15:28:23 -07:00
parent d8dfb81806
commit 1ed1d1c842
21 changed files with 21 additions and 22 deletions

View File

@ -64,7 +64,7 @@
//:
//: "Programming properly should be regarded as an activity by which
//: programmers form a mental model, rather than as production of a program."
//: -- Peter Naur (http://alistair.cockburn.us/ASD+book+extract%3A+%22Naur,+Ehn,+Musashi%22)
//: -- Peter Naur (http://akkartik.name/naur.pdf)
//:: == Core data structures

View File

@ -1,2 +1,2 @@
Larger programs than in the subx/examples/ subdirectory, combining the
techniques demonstrated there.
Larger programs than in the examples/ subdirectory, combining the techniques
demonstrated there.

View File

@ -6,7 +6,7 @@
# Drop lines that are all comments. They could get misleading after assortment
# because we don't know if they refer to the line above or the line below.
#
# To run (from the subx/ directory):
# To run:
# $ ./subx translate *.subx apps/assort.subx -o apps/assort
# $ cat x
# == code

View File

@ -2,7 +2,7 @@
# which corresponds to the section "single digits" in https://compilers.iecc.com/crenshaw/tutor2.txt
# except that we support hex digits.
#
# To run (from the subx/ directory):
# To run:
# $ ./subx translate *.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1
# $ echo '3' |./subx run apps/crenshaw2-1
# Expected output:

View File

@ -2,7 +2,7 @@
# which corresponds to the section "single digits" in https://compilers.iecc.com/crenshaw/tutor2.txt
# except that we support hex numbers of multiple digits.
#
# To run (from the subx/ directory):
# To run:
# $ ./subx translate *.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b
# $ echo '1a' |./subx run apps/crenshaw2-1b
# Expected output:

View File

@ -1,7 +1,7 @@
# Translate literal strings within double quotes.
# Replace them with references to new variables in the data segment.
#
# To run (from the subx/ directory):
# To run:
# $ ./subx translate *.subx apps/dquotes.subx -o apps/dquotes
# $ cat x
# == code

View File

@ -1,6 +1,6 @@
## compute the factorial of 5, and return the result in the exit code
#
# To run (from the subx directory):
# To run:
# $ ./subx translate apps/factorial.subx -o apps/factorial
# $ ./subx run apps/factorial
# Expected result:

View File

@ -12,7 +12,7 @@
# offset 0: alloc id
# offset 4: address
#
# To run (from the subx directory):
# To run:
# $ ./subx translate *.subx apps/handle.subx -o apps/handle
# $ ./subx run apps/handle
# Expected result is a successful lookup followed by a hard abort:

View File

@ -2,7 +2,7 @@
# from stdin, and convert them into binary bytes (octets) on stdout. Ignore
# comments between '#' and newline.
#
# To run (from the subx/ directory):
# To run:
# $ ./subx translate *.subx apps/hex.subx -o apps/hex
# $ echo '80 81 82 # comment' |./subx run apps/hex |xxd -
# Expected output:

View File

@ -2,7 +2,7 @@
# of whitespace-separated ascii hex bytes on stdout. Label definitions and
# uses are left untouched.
#
# To run (from the subx/ directory):
# To run:
# $ ./subx translate *.subx apps/pack.subx -o apps/pack
# $ echo '05/add-to-EAX 0x20/imm32' |./subx run apps/pack
# Expected output:

View File

@ -4,7 +4,7 @@
# a) replace labels
# b) add segment headers with addresses and offsets correctly filled in
#
# To build (from the subx/ directory):
# To build:
# $ ./subx translate *.subx apps/survey.subx -o apps/survey
#
# The expected input is a stream of bytes with segment headers, comments and

View File

@ -68,7 +68,7 @@ if ('onhashchange' in window) {
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># Drop lines that are all comments. They could get misleading after assortment</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># because we don't know if they refer to the line above or the line below.</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment">#</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># To run (from the subx/ directory):</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment"># To run:</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxComment"># $ ./subx translate *.subx apps/assort.subx -o apps/assort</span>
<span id="L11" class="LineNr"> 11 </span><span class="subxComment"># $ cat x</span>
<span id="L12" class="LineNr"> 12 </span><span class="subxComment"># == code</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L2" class="LineNr"> 2 </span><span class="subxComment"># which corresponds to the section &quot;single digits&quot; in <a href="https://compilers.iecc.com/crenshaw/tutor2.txt">https://compilers.iecc.com/crenshaw/tutor2.txt</a></span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># except that we support hex digits.</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment">#</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run (from the subx/ directory):</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run:</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># $ ./subx translate *.subx apps/crenshaw2-1.subx -o apps/crenshaw2-1</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># $ echo '3' |./subx run apps/crenshaw2-1</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># Expected output:</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L2" class="LineNr"> 2 </span><span class="subxComment"># which corresponds to the section &quot;single digits&quot; in <a href="https://compilers.iecc.com/crenshaw/tutor2.txt">https://compilers.iecc.com/crenshaw/tutor2.txt</a></span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># except that we support hex numbers of multiple digits.</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment">#</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run (from the subx/ directory):</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run:</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># $ ./subx translate *.subx apps/crenshaw2-1b.subx -o apps/crenshaw2-1b</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># $ echo '1a' |./subx run apps/crenshaw2-1b</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># Expected output:</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Translate literal strings within double quotes.</span>
<span id="L2" class="LineNr"> 2 </span><span class="subxComment"># Replace them with references to new variables in the data segment.</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment">#</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># To run (from the subx/ directory):</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># To run:</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># $ ./subx translate *.subx apps/dquotes.subx -o apps/dquotes</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># $ cat x</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># == code</span>

View File

@ -61,7 +61,7 @@ if ('onhashchange' in window) {
<pre id='vimCodeElement'>
<span id="L1" class="LineNr"> 1 </span><span class="subxComment">## compute the factorial of 5, and return the result in the exit code</span>
<span id="L2" class="LineNr"> 2 </span><span class="subxComment">#</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># To run (from the subx directory):</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># To run:</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># $ ./subx translate apps/factorial.subx -o apps/factorial</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># $ ./subx run apps/factorial</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># Expected result:</span>

View File

@ -75,7 +75,7 @@ if ('onhashchange' in window) {
<span id="L12" class="LineNr"> 12 </span><span class="subxComment"># offset 0: alloc id</span>
<span id="L13" class="LineNr"> 13 </span><span class="subxComment"># offset 4: address</span>
<span id="L14" class="LineNr"> 14 </span><span class="subxComment">#</span>
<span id="L15" class="LineNr"> 15 </span><span class="subxComment"># To run (from the subx directory):</span>
<span id="L15" class="LineNr"> 15 </span><span class="subxComment"># To run:</span>
<span id="L16" class="LineNr"> 16 </span><span class="subxComment"># $ ./subx translate *.subx apps/handle.subx -o apps/handle</span>
<span id="L17" class="LineNr"> 17 </span><span class="subxComment"># $ ./subx run apps/handle</span>
<span id="L18" class="LineNr"> 18 </span><span class="subxComment"># Expected result is a successful lookup followed by a hard abort:</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L2" class="LineNr"> 2 </span><span class="subxComment"># from stdin, and convert them into binary bytes (octets) on stdout. Ignore</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># comments between '#' and newline.</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment">#</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run (from the subx/ directory):</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run:</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># $ ./subx translate *.subx apps/hex.subx -o apps/hex</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># $ echo '80 81 82 # comment' |./subx run apps/hex |xxd -</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># Expected output:</span>

View File

@ -64,7 +64,7 @@ if ('onhashchange' in window) {
<span id="L2" class="LineNr"> 2 </span><span class="subxComment"># of whitespace-separated ascii hex bytes on stdout. Label definitions and</span>
<span id="L3" class="LineNr"> 3 </span><span class="subxComment"># uses are left untouched.</span>
<span id="L4" class="LineNr"> 4 </span><span class="subxComment">#</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run (from the subx/ directory):</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># To run:</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment"># $ ./subx translate *.subx apps/pack.subx -o apps/pack</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># $ echo '05/add-to-EAX 0x20/imm32' |./subx run apps/pack</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># Expected output:</span>

View File

@ -67,7 +67,7 @@ if ('onhashchange' in window) {
<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># a) replace labels</span>
<span id="L5" class="LineNr"> 5 </span><span class="subxComment"># b) add segment headers with addresses and offsets correctly filled in</span>
<span id="L6" class="LineNr"> 6 </span><span class="subxComment">#</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># To build (from the subx/ directory):</span>
<span id="L7" class="LineNr"> 7 </span><span class="subxComment"># To build:</span>
<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># $ ./subx translate *.subx apps/survey.subx -o apps/survey</span>
<span id="L9" class="LineNr"> 9 </span><span class="subxComment">#</span>
<span id="L10" class="LineNr"> 10 </span><span class="subxComment"># The expected input is a stream of bytes with segment headers, comments and</span>

View File

@ -34,7 +34,6 @@ augroup END
" opening a second file in a new or existing window (shouldn't mess up existing highlighting)
" reloading an existing file (shouldn't mess up existing highlighting)
" assumes CWD is subx/
command! -nargs=1 E call EditSubx("edit", <f-args>)
if exists("&splitvertical")
command! -nargs=1 S call EditSubx("vert split", <f-args>)