diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-03-01 23:27:07 -0800 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-03-01 23:27:07 -0800 |
commit | 124be197a0385f21193c404b7575597dfc19a3f2 (patch) | |
tree | a9492bb5321acef17183287ecc95b8207a7e3ec1 /baremetal/shell | |
parent | 0749772be12078cb6317d1d53d03444c00f9810b (diff) | |
download | mu-124be197a0385f21193c404b7575597dfc19a3f2.tar.gz |
7838
Diffstat (limited to 'baremetal/shell')
-rw-r--r-- | baremetal/shell/cell.mu | 6 | ||||
-rw-r--r-- | baremetal/shell/parse.mu | 6 | ||||
-rw-r--r-- | baremetal/shell/print.mu | 18 |
3 files changed, 15 insertions, 15 deletions
diff --git a/baremetal/shell/cell.mu b/baremetal/shell/cell.mu index 8627af1c..aeda65f6 100644 --- a/baremetal/shell/cell.mu +++ b/baremetal/shell/cell.mu @@ -11,7 +11,7 @@ type cell { # TODO: array, (associative) table, stream } -fn new-symbol _out: (addr handle cell) { +fn allocate-symbol _out: (addr handle cell) { var out/eax: (addr handle cell) <- copy _out allocate out var out-addr/eax: (addr cell) <- lookup *out @@ -21,7 +21,7 @@ fn new-symbol _out: (addr handle cell) { populate-stream dest-ah, 0x40/max-symbol-size } -fn new-number _out: (addr handle cell) { +fn allocate-number _out: (addr handle cell) { var out/eax: (addr handle cell) <- copy _out allocate out var out-addr/eax: (addr cell) <- lookup *out @@ -29,7 +29,7 @@ fn new-number _out: (addr handle cell) { copy-to *type, 1/number } -fn new-pair _out: (addr handle cell) { +fn allocate-pair _out: (addr handle cell) { var out/eax: (addr handle cell) <- copy _out allocate out # new cells have type pair by default diff --git a/baremetal/shell/parse.mu b/baremetal/shell/parse.mu index 5acab714..a0045eb3 100644 --- a/baremetal/shell/parse.mu +++ b/baremetal/shell/parse.mu @@ -52,7 +52,7 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace break-if-= var curr/esi: (addr handle cell) <- copy _out $parse-sexpression:list-loop: { - new-pair curr + allocate-pair curr var curr-addr/eax: (addr cell) <- lookup *curr var left/ecx: (addr handle cell) <- get curr-addr, left { @@ -104,7 +104,7 @@ fn parse-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr t var _val/eax: int <- parse-decimal-int-from-stream curr-token-data var val/ecx: int <- copy _val var val-float/xmm0: float <- convert val - new-number _out + allocate-number _out var out/eax: (addr handle cell) <- copy _out var out-addr/eax: (addr cell) <- lookup *out var dest/edi: (addr float) <- get out-addr, number-data @@ -120,7 +120,7 @@ fn parse-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr t } # default: symbol # just copy token data - new-symbol _out + allocate-symbol _out var out/eax: (addr handle cell) <- copy _out var out-addr/eax: (addr cell) <- lookup *out var curr-token-data-ah/ecx: (addr handle stream byte) <- get curr-token, text-data diff --git a/baremetal/shell/print.mu b/baremetal/shell/print.mu index d3eb6f1f..da35c049 100644 --- a/baremetal/shell/print.mu +++ b/baremetal/shell/print.mu @@ -144,7 +144,7 @@ fn is-nil? _in: (addr cell) -> _/eax: boolean { fn test-print-cell-zero { var num-storage: (handle cell) var num/esi: (addr handle cell) <- address num-storage - new-number num + allocate-number num # value is 0 by default var out-storage: (stream byte 0x40) var out/edi: (addr stream byte) <- address out-storage @@ -155,7 +155,7 @@ fn test-print-cell-zero { fn test-print-cell-integer { var num-storage: (handle cell) var num/esi: (addr handle cell) <- address num-storage - new-number num + allocate-number num var num-addr/eax: (addr cell) <- lookup *num var num-data/eax: (addr float) <- get num-addr, number-data var src/xmm0: float <- rational 1, 1 @@ -169,7 +169,7 @@ fn test-print-cell-integer { fn test-print-cell-integer-2 { var num-storage: (handle cell) var num/esi: (addr handle cell) <- address num-storage - new-number num + allocate-number num var num-addr/eax: (addr cell) <- lookup *num var num-data/eax: (addr float) <- get num-addr, number-data var src/xmm0: float <- rational 0x30, 1 @@ -183,7 +183,7 @@ fn test-print-cell-integer-2 { fn test-print-cell-fraction { var num-storage: (handle cell) var num/esi: (addr handle cell) <- address num-storage - new-number num + allocate-number num var num-addr/eax: (addr cell) <- lookup *num var num-data/eax: (addr float) <- get num-addr, number-data var src/xmm0: float <- rational 1, 2 @@ -197,7 +197,7 @@ fn test-print-cell-fraction { fn test-print-cell-symbol { var sym-storage: (handle cell) var sym/esi: (addr handle cell) <- address sym-storage - new-symbol sym + allocate-symbol sym var sym-addr/eax: (addr cell) <- lookup *sym var sym-data-ah/eax: (addr handle stream byte) <- get sym-addr, text-data var sym-data/eax: (addr stream byte) <- lookup *sym-data-ah @@ -211,7 +211,7 @@ fn test-print-cell-symbol { fn test-print-cell-nil-list { var nil-storage: (handle cell) var nil/esi: (addr handle cell) <- address nil-storage - new-pair nil + allocate-pair nil var out-storage: (stream byte 0x40) var out/edi: (addr stream byte) <- address out-storage print-cell nil, out, 0/no-trace @@ -221,11 +221,11 @@ fn test-print-cell-nil-list { fn test-print-cell-singleton-list { var list-storage: (handle cell) var list/esi: (addr handle cell) <- address list-storage - new-pair list + allocate-pair list # left var list-addr/eax: (addr cell) <- lookup *list var list-left/eax: (addr handle cell) <- get list-addr, left - new-symbol list-left + allocate-symbol list-left var sym-addr/eax: (addr cell) <- lookup *list-left var sym-data-ah/eax: (addr handle stream byte) <- get sym-addr, text-data var sym-data/eax: (addr stream byte) <- lookup *sym-data-ah @@ -233,7 +233,7 @@ fn test-print-cell-singleton-list { # right var list-addr/eax: (addr cell) <- lookup *list var list-right/eax: (addr handle cell) <- get list-addr, right - new-pair list-right + allocate-pair list-right # var out-storage: (stream byte 0x40) var out/edi: (addr stream byte) <- address out-storage |