diff options
Diffstat (limited to 'shell')
-rw-r--r-- | shell/eval.mu | 60 | ||||
-rw-r--r-- | shell/grapheme-stack.mu | 2 | ||||
-rw-r--r-- | shell/parse.mu | 20 | ||||
-rw-r--r-- | shell/print.mu | 10 | ||||
-rw-r--r-- | shell/tokenize.mu | 34 | ||||
-rw-r--r-- | shell/trace.mu | 12 |
6 files changed, 69 insertions, 69 deletions
diff --git a/shell/eval.mu b/shell/eval.mu index 13822aac..e1fc3c50 100644 --- a/shell/eval.mu +++ b/shell/eval.mu @@ -17,8 +17,8 @@ fn evaluate _in: (addr handle cell), out: (addr handle cell), env-h: (handle cel trace-lower trace var in-addr/eax: (addr cell) <- lookup *in { - var is-nil?/eax: boolean <- is-nil? in-addr - compare is-nil?, 0/false + var nil?/eax: boolean <- nil? in-addr + compare nil?, 0/false break-if-= # nil is a literal trace-text trace, "eval", "nil" @@ -51,8 +51,8 @@ fn evaluate _in: (addr handle cell), out: (addr handle cell), env-h: (handle cel # if its first elem is not "fn", break var first-ah/ecx: (addr handle cell) <- get in-addr, left var first/eax: (addr cell) <- lookup *first-ah - var is-fn?/eax: boolean <- is-fn? first - compare is-fn?, 0/false + var fn?/eax: boolean <- fn? first + compare fn?, 0/false break-if-= # trace-text trace, "eval", "anonymous function" @@ -68,8 +68,8 @@ fn evaluate _in: (addr handle cell), out: (addr handle cell), env-h: (handle cel var curr/ecx: (addr cell) <- copy in-addr $evaluate-list:loop: { allocate-pair curr-out-ah - var is-nil?/eax: boolean <- is-nil? curr - compare is-nil?, 0/false + var nil?/eax: boolean <- nil? curr + compare nil?, 0/false break-if-!= # eval left var curr-out/eax: (addr cell) <- lookup *curr-out-ah @@ -133,8 +133,8 @@ fn apply _f-ah: (addr handle cell), args-ah: (addr handle cell), out: (addr hand break-if-!= var first-ah/eax: (addr handle cell) <- get f, left var first/eax: (addr cell) <- lookup *first-ah - var is-fn?/eax: boolean <- is-fn? first - compare is-fn?, 0/false + var fn?/eax: boolean <- fn? first + compare fn?, 0/false break-if-= var rest-ah/esi: (addr handle cell) <- get f, right var rest/eax: (addr cell) <- lookup *rest-ah @@ -158,8 +158,8 @@ fn apply-function params-ah: (addr handle cell), args-ah: (addr handle cell), _b var body/eax: (addr cell) <- lookup *body-ah # stop when body is nil { - var body-is-nil?/eax: boolean <- is-nil? body - compare body-is-nil?, 0/false + var body-nil?/eax: boolean <- nil? body + compare body-nil?, 0/false break-if-!= $apply-function:body } # evaluate each expression, writing result to `out` @@ -191,8 +191,8 @@ fn push-bindings _params-ah: (addr handle cell), _args-ah: (addr handle cell), o var _params/eax: (addr cell) <- lookup *params-ah var params/esi: (addr cell) <- copy _params { - var params-is-nil?/eax: boolean <- is-nil? params - compare params-is-nil?, 0/false + var params-nil?/eax: boolean <- nil? params + compare params-nil?, 0/false break-if-= # nil is a literal trace-text trace, "eval", "done with push-bindings" @@ -278,7 +278,7 @@ fn apply-add _args-ah: (addr handle cell), out: (addr handle cell), env-h: (hand var _env/eax: (addr cell) <- lookup env-h var env/edi: (addr cell) <- copy _env # TODO: check that args is a pair - var empty-args?/eax: boolean <- is-nil? args + var empty-args?/eax: boolean <- nil? args compare empty-args?, 0/false { break-if-= @@ -348,8 +348,8 @@ fn lookup-symbol sym: (addr cell), out: (addr handle cell), env-h: (handle cell) } # if env is nil, look up in globals { - var env-is-nil?/eax: boolean <- is-nil? env - compare env-is-nil?, 0/false + var env-nil?/eax: boolean <- nil? env + compare env-nil?, 0/false break-if-= lookup-symbol-in-hardcoded-globals sym, out, trace trace-higher trace @@ -446,8 +446,8 @@ fn lookup-symbol-in-hardcoded-globals _sym: (addr cell), out: (addr handle cell) var _sym-data/eax: (addr stream byte) <- lookup *sym-data-ah var sym-data/esi: (addr stream byte) <- copy _sym-data { - var is-add?/eax: boolean <- stream-data-equal? sym-data, "+" - compare is-add?, 0/false + var add?/eax: boolean <- stream-data-equal? sym-data, "+" + compare add?, 0/false break-if-= new-primitive-function out, 1/add trace-text trace, "eval", "global +" @@ -525,8 +525,8 @@ fn car _in: (addr cell), out: (addr handle cell), trace: (addr trace) { } # if in is nil, abort { - var in-is-nil?/eax: boolean <- is-nil? in - compare in-is-nil?, 0/false + var in-nil?/eax: boolean <- nil? in + compare in-nil?, 0/false break-if-= error trace, "car on nil" trace-higher trace @@ -553,8 +553,8 @@ fn cdr _in: (addr cell), out: (addr handle cell), trace: (addr trace) { } # if in is nil, abort { - var in-is-nil?/eax: boolean <- is-nil? in - compare in-is-nil?, 0/false + var in-nil?/eax: boolean <- nil? in + compare in-nil?, 0/false break-if-= error trace, "car on nil" trace-higher trace @@ -630,15 +630,15 @@ fn cell-isomorphic? _a: (addr cell), _b: (addr cell), trace: (addr trace) -> _/e } # if a is nil, b should be nil { - # (assumes is-nil? returns 0 or 1) - var _b-is-nil?/eax: boolean <- is-nil? b - var b-is-nil?/ecx: boolean <- copy _b-is-nil? - var a-is-nil?/eax: boolean <- is-nil? a + # (assumes nil? returns 0 or 1) + var _b-nil?/eax: boolean <- nil? b + var b-nil?/ecx: boolean <- copy _b-nil? + var a-nil?/eax: boolean <- nil? a # a == nil and b == nil => return true { - compare a-is-nil?, 0/false + compare a-nil?, 0/false break-if-= - compare b-is-nil?, 0/false + compare b-nil?, 0/false break-if-= trace-higher trace trace-text trace, "eval", "=> true (nils)" @@ -646,7 +646,7 @@ fn cell-isomorphic? _a: (addr cell), _b: (addr cell), trace: (addr trace) -> _/e } # a == nil => return false { - compare a-is-nil?, 0/false + compare a-nil?, 0/false break-if-= trace-higher trace trace-text trace, "eval", "=> false (b != nil)" @@ -654,7 +654,7 @@ fn cell-isomorphic? _a: (addr cell), _b: (addr cell), trace: (addr trace) -> _/e } # b == nil => return false { - compare b-is-nil?, 0/false + compare b-nil?, 0/false break-if-= trace-higher trace trace-text trace, "eval", "=> false (a != nil)" @@ -691,7 +691,7 @@ fn cell-isomorphic? _a: (addr cell), _b: (addr cell), trace: (addr trace) -> _/e return result } -fn is-fn? _x: (addr cell) -> _/eax: boolean { +fn fn? _x: (addr cell) -> _/eax: boolean { var x/esi: (addr cell) <- copy _x var type/eax: (addr int) <- get x, type compare *type, 2/symbol diff --git a/shell/grapheme-stack.mu b/shell/grapheme-stack.mu index 456df0cb..ab42e6fa 100644 --- a/shell/grapheme-stack.mu +++ b/shell/grapheme-stack.mu @@ -270,7 +270,7 @@ fn grapheme-stack-is-decimal-integer? _self: (addr grapheme-stack) -> _/eax: boo compare i, *top-addr break-if->= var g/edx: (addr grapheme) <- index data, i - result <- is-decimal-digit? *g + result <- decimal-digit? *g compare result, 0/false break-if-= i <- increment diff --git a/shell/parse.mu b/shell/parse.mu index a0045eb3..eea5b13f 100644 --- a/shell/parse.mu +++ b/shell/parse.mu @@ -38,16 +38,16 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace read-from-stream tokens, curr-token $parse-sexpression:type-check: { # not bracket -> parse atom - var is-bracket-token?/eax: boolean <- is-bracket-token? curr-token - compare is-bracket-token?, 0/false + var bracket-token?/eax: boolean <- bracket-token? curr-token + compare bracket-token?, 0/false { break-if-!= parse-atom curr-token, _out, trace break $parse-sexpression:type-check } # open paren -> parse list - var is-open-paren?/eax: boolean <- is-open-paren-token? curr-token - compare is-open-paren?, 0/false + var open-paren?/eax: boolean <- open-paren-token? curr-token + compare open-paren?, 0/false { break-if-= var curr/esi: (addr handle cell) <- copy _out @@ -56,8 +56,8 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace var curr-addr/eax: (addr cell) <- lookup *curr var left/ecx: (addr handle cell) <- get curr-addr, left { - var is-close-paren?/eax: boolean <- parse-sexpression tokens, left, trace - compare is-close-paren?, 0/false + var close-paren?/eax: boolean <- parse-sexpression tokens, left, trace + compare close-paren?, 0/false break-if-!= $parse-sexpression:list-loop } # @@ -67,8 +67,8 @@ fn parse-sexpression tokens: (addr stream cell), _out: (addr handle cell), trace break $parse-sexpression:type-check } # close paren -> parse list - var is-close-paren?/eax: boolean <- is-close-paren-token? curr-token - compare is-close-paren?, 0/false + var close-paren?/eax: boolean <- close-paren-token? curr-token + compare close-paren?, 0/false { break-if-= trace-higher trace @@ -96,8 +96,8 @@ fn parse-atom _curr-token: (addr cell), _out: (addr handle cell), trace: (addr t var curr-token-data/esi: (addr stream byte) <- copy _curr-token-data trace trace, "read", curr-token-data # number - var is-number-token?/eax: boolean <- is-number-token? curr-token - compare is-number-token?, 0/false + var number-token?/eax: boolean <- number-token? curr-token + compare number-token?, 0/false { break-if-= rewind-stream curr-token-data diff --git a/shell/print.mu b/shell/print.mu index ff2a9ed6..53677c22 100644 --- a/shell/print.mu +++ b/shell/print.mu @@ -4,8 +4,8 @@ fn print-cell _in: (addr handle cell), out: (addr stream byte), trace: (addr tra var in/eax: (addr handle cell) <- copy _in var in-addr/eax: (addr cell) <- lookup *in { - var is-nil?/eax: boolean <- is-nil? in-addr - compare is-nil?, 0/false + var nil?/eax: boolean <- nil? in-addr + compare nil?, 0/false break-if-= write out, "()" trace-higher trace @@ -88,8 +88,8 @@ fn print-list _in: (addr cell), out: (addr stream byte), trace: (addr trace) { abort "null encountered" } { - var right-is-nil?/eax: boolean <- is-nil? right-addr - compare right-is-nil?, 0/false + var right-nil?/eax: boolean <- nil? right-addr + compare right-nil?, 0/false { break-if-= trace-text trace, "print", "right is null" @@ -113,7 +113,7 @@ fn print-list _in: (addr cell), out: (addr stream byte), trace: (addr trace) { # Most lisps intern nil, but we don't really have globals yet, so we'll be # less efficient for now. -fn is-nil? _in: (addr cell) -> _/eax: boolean { +fn nil? _in: (addr cell) -> _/eax: boolean { var in/esi: (addr cell) <- copy _in # if type != pair, return false var type/eax: (addr int) <- get in, type diff --git a/shell/tokenize.mu b/shell/tokenize.mu index b6ca1ffd..d28f59dc 100644 --- a/shell/tokenize.mu +++ b/shell/tokenize.mu @@ -50,7 +50,7 @@ fn next-token in: (addr gap-buffer), _out-cell: (addr cell), trace: (addr trace) } # digit { - var digit?/eax: boolean <- is-decimal-digit? g + var digit?/eax: boolean <- decimal-digit? g compare digit?, 0/false break-if-= next-number-token in, out, trace @@ -58,7 +58,7 @@ fn next-token in: (addr gap-buffer), _out-cell: (addr cell), trace: (addr trace) } # other symbol char { - var symbol?/eax: boolean <- is-symbol-grapheme? g + var symbol?/eax: boolean <- symbol-grapheme? g compare symbol?, 0/false break-if-= next-symbol-token in, out, trace @@ -66,7 +66,7 @@ fn next-token in: (addr gap-buffer), _out-cell: (addr cell), trace: (addr trace) } # brackets are always single-char tokens { - var bracket?/eax: boolean <- is-bracket-grapheme? g + var bracket?/eax: boolean <- bracket-grapheme? g compare bracket?, 0/false break-if-= var g/eax: grapheme <- read-from-gap-buffer in @@ -75,7 +75,7 @@ fn next-token in: (addr gap-buffer), _out-cell: (addr cell), trace: (addr trace) } # non-symbol operators { - var operator?/eax: boolean <- is-operator-grapheme? g + var operator?/eax: boolean <- operator-grapheme? g compare operator?, 0/false break-if-= next-operator-token in, out, trace @@ -109,7 +109,7 @@ fn next-symbol-token in: (addr gap-buffer), out: (addr stream byte), trace: (add } # if non-symbol, return { - var symbol-grapheme?/eax: boolean <- is-symbol-grapheme? g + var symbol-grapheme?/eax: boolean <- symbol-grapheme? g compare symbol-grapheme?, 0/false break-if-!= trace-text trace, "read", "stop" @@ -146,7 +146,7 @@ fn next-operator-token in: (addr gap-buffer), out: (addr stream byte), trace: (a } # if non-operator, return { - var operator-grapheme?/eax: boolean <- is-operator-grapheme? g + var operator-grapheme?/eax: boolean <- operator-grapheme? g compare operator-grapheme?, 0/false break-if-!= trace-text trace, "read", "stop" @@ -183,7 +183,7 @@ fn next-number-token in: (addr gap-buffer), out: (addr stream byte), trace: (add } # if not symbol grapheme, return { - var symbol-grapheme?/eax: boolean <- is-symbol-grapheme? g + var symbol-grapheme?/eax: boolean <- symbol-grapheme? g compare symbol-grapheme?, 0/false break-if-!= trace-text trace, "read", "stop" @@ -191,7 +191,7 @@ fn next-number-token in: (addr gap-buffer), out: (addr stream byte), trace: (add } # if not digit grapheme, abort { - var digit?/eax: boolean <- is-decimal-digit? g + var digit?/eax: boolean <- decimal-digit? g compare digit?, 0/false break-if-!= error trace, "invalid number" @@ -216,7 +216,7 @@ fn next-bracket-token g: grapheme, out: (addr stream byte), trace: (addr trace) trace trace, "read", stream } -fn is-symbol-grapheme? g: grapheme -> _/eax: boolean { +fn symbol-grapheme? g: grapheme -> _/eax: boolean { ## whitespace compare g, 9/tab { @@ -383,7 +383,7 @@ fn is-symbol-grapheme? g: grapheme -> _/eax: boolean { return 1/true } -fn is-bracket-grapheme? g: grapheme -> _/eax: boolean { +fn bracket-grapheme? g: grapheme -> _/eax: boolean { compare g, 0x28/open-paren { break-if-!= @@ -417,7 +417,7 @@ fn is-bracket-grapheme? g: grapheme -> _/eax: boolean { return 0/false } -fn is-operator-grapheme? g: grapheme -> _/eax: boolean { +fn operator-grapheme? g: grapheme -> _/eax: boolean { # '$' is a symbol char compare g, 0x25/percent { @@ -519,27 +519,27 @@ fn is-operator-grapheme? g: grapheme -> _/eax: boolean { return 0/false } -fn is-number-token? _in: (addr cell) -> _/eax: boolean { +fn number-token? _in: (addr cell) -> _/eax: boolean { var in/eax: (addr cell) <- copy _in var in-data-ah/eax: (addr handle stream byte) <- get in, text-data var in-data/eax: (addr stream byte) <- lookup *in-data-ah rewind-stream in-data var g/eax: grapheme <- read-grapheme in-data - var result/eax: boolean <- is-decimal-digit? g + var result/eax: boolean <- decimal-digit? g return result } -fn is-bracket-token? _in: (addr cell) -> _/eax: boolean { +fn bracket-token? _in: (addr cell) -> _/eax: boolean { var in/eax: (addr cell) <- copy _in var in-data-ah/eax: (addr handle stream byte) <- get in, text-data var in-data/eax: (addr stream byte) <- lookup *in-data-ah rewind-stream in-data var g/eax: grapheme <- read-grapheme in-data - var result/eax: boolean <- is-bracket-grapheme? g + var result/eax: boolean <- bracket-grapheme? g return result } -fn is-open-paren-token? _in: (addr cell) -> _/eax: boolean { +fn open-paren-token? _in: (addr cell) -> _/eax: boolean { var in/eax: (addr cell) <- copy _in var in-data-ah/eax: (addr handle stream byte) <- get in, text-data var in-data/eax: (addr stream byte) <- lookup *in-data-ah @@ -553,7 +553,7 @@ fn is-open-paren-token? _in: (addr cell) -> _/eax: boolean { return 0/false } -fn is-close-paren-token? _in: (addr cell) -> _/eax: boolean { +fn close-paren-token? _in: (addr cell) -> _/eax: boolean { var in/eax: (addr cell) <- copy _in var in-data-ah/eax: (addr handle stream byte) <- get in, text-data var in-data/eax: (addr stream byte) <- lookup *in-data-ah diff --git a/shell/trace.mu b/shell/trace.mu index 26393d2b..e3269088 100644 --- a/shell/trace.mu +++ b/shell/trace.mu @@ -70,8 +70,8 @@ fn has-errors? _self: (addr trace) -> _/eax: boolean { var curr/eax: (addr trace-line) <- index trace, offset var curr-label-ah/eax: (addr handle array byte) <- get curr, label var curr-label/eax: (addr array byte) <- lookup *curr-label-ah - var is-error?/eax: boolean <- string-equal? curr-label, "error" - compare is-error?, 0/false + var error?/eax: boolean <- string-equal? curr-label, "error" + compare error?, 0/false { break-if-= return 1/true @@ -340,9 +340,9 @@ fn render-trace screen: (addr screen), _self: (addr trace), xmin: int, ymin: int copy-to *cursor-line-index, i } # always display errors - var is-error?/eax: boolean <- string-equal? curr-label, "error" + var error?/eax: boolean <- string-equal? curr-label, "error" { - compare is-error?, 0/false + compare error?, 0/false break-if-= y <- render-trace-line screen, curr, xmin, y, xmax, ymax, 0xc/fg=trace-error, bg copy-to already-hiding-lines?, 0/false @@ -383,8 +383,8 @@ fn render-trace-line screen: (addr screen), _self: (addr trace-line), xmin: int, var label-ah/eax: (addr handle array byte) <- get self, label var _label/eax: (addr array byte) <- lookup *label-ah var label/ebx: (addr array byte) <- copy _label - var is-error?/eax: boolean <- string-equal? label, "error" - compare is-error?, 0/false + var error?/eax: boolean <- string-equal? label, "error" + compare error?, 0/false { break-if-!= var x/eax: int <- copy xsave |