This commit is contained in:
Kartik Agaram 2018-10-01 12:28:30 -07:00
parent 57628c0e44
commit 2b51cba67c
12 changed files with 36 additions and 36 deletions

View File

@ -1,9 +1,9 @@
## first program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
# Just return 42.
#
# To run:
# $ subx translate ex1.2.subx -o ex1
# $ subx run ex1
# To run (from the subx directory):
# $ subx translate examples/ex1.2.subx -o examples/ex1
# $ subx run examples/ex1
# Expected result:
# $ echo $?
# 42

View File

@ -1,8 +1,8 @@
## String comparison: return 1 iff the two args passed in at the commandline are equal.
#
# To run:
# $ subx translate ex10.subx -o ex10
# $ subx run ex10 abc abd
# To run (from the subx directory):
# $ subx translate examples/ex10.subx -o examples/ex10
# $ subx run examples/ex10 abc abd
# Expected result:
# $ echo $?
# 0 # false

View File

@ -5,9 +5,9 @@
# This example shows a helper that can compare a commandline argument with the
# (length-prefixed) literal string "target".
#
# To run:
# $ subx translate ex11.subx -o ex11
# $ subx run ex11 # runs a series of tests
# To run (from the subx directory):
# $ subx translate examples/ex11.subx -o examples/ex11
# $ subx run examples/ex11 # runs a series of tests
# ...... # all tests pass
#
# (We can't yet run the tests when given a "test" commandline argument,

View File

@ -1,9 +1,9 @@
## example showing mmap syscall
# Create a new segment using mmap, save the address, write to it.
#
# To run:
# $ subx translate ex12.subx -o ex12
# $ subx run ex12
# To run (from the subx directory):
# $ subx translate examples/ex12.subx -o examples/ex12
# $ subx run examples/ex12
# You shouldn't get a segmentation fault.
== code

View File

@ -1,8 +1,8 @@
## add 1 and 1, and return the result in the exit code
#
# To run:
# $ subx translate ex2.subx -o ex2
# $ subx run ex2
# To run (from the subx directory):
# $ subx translate examples/ex2.subx -o examples/ex2
# $ subx run examples/ex2
# Expected result:
# $ echo $?
# 2

View File

@ -1,8 +1,8 @@
## add the first 10 numbers, and return the result in the exit code
#
# To run:
# $ subx translate ex3.subx -o ex3
# $ subx run ex3
# To run (from the subx directory):
# $ subx translate examples/ex3.subx -o examples/ex3
# $ subx run examples/ex3
# Expected result:
# $ echo $?
# 55

View File

@ -1,8 +1,8 @@
## read a character from stdin, save it to a global, write it to stdout
#
# To run:
# $ subx translate ex4.subx -o ex4
# $ subx run ex4
# To run (from the subx directory):
# $ subx translate examples/ex4.subx -o examples/ex4
# $ subx run examples/ex4
== code
# instruction effective address operand displacement immediate

View File

@ -1,8 +1,8 @@
## read a character from stdin, save it to a local on the stack, write it to stdout
#
# To run:
# $ subx translate ex5.subx -o ex5
# $ subx run ex5
# To run (from the subx directory):
# $ subx translate examples/ex5.subx -o examples/ex5
# $ subx run examples/ex5
== code
# instruction effective address operand displacement immediate

View File

@ -1,8 +1,8 @@
## print out a (global variable) string to stdout
#
# To run:
# $ subx translate ex6.subx -o ex6
# $ subx run ex6
# To run (from the subx directory):
# $ subx translate examples/ex6.subx -o examples/ex6
# $ subx run examples/ex6
# Hello, world!
== code

View File

@ -3,9 +3,9 @@
# it for reading, read a character from it, close it, delete it, and return
# the character read.
#
# To run:
# $ subx translate ex8.subx -o ex8
# $ subx run ex8
# To run (from the subx directory):
# $ subx translate examples/ex8.subx -o examples/ex8
# $ subx run examples/ex8
# Expected result:
# $ echo $?
# 97

View File

@ -1,8 +1,8 @@
## Example reading commandline arguments: compute length of first arg.
#
# To run:
# $ subx translate ex8.subx -o ex8
# $ subx run ex8 abc de fghi
# To run (from the subx directory):
# $ subx translate examples/ex8.subx -o examples/ex8
# $ subx run examples/ex8 abc de fghi
# Expected result:
# $ echo $?
# 3 # length of 'abc'

View File

@ -2,9 +2,9 @@
# Show difference between ascii codes of first letter of first arg and first
# letter of second arg.
#
# To run:
# $ subx translate ex9.subx -o ex9
# $ subx run ex9 z x
# To run (from the subx directory):
# $ subx translate examples/ex9.subx -o examples/ex9
# $ subx run examples/ex9 z x
# Expected result:
# $ echo $?
# 2