7849 - shell: literal numbers
This commit is contained in:
parent
57c3617ef6
commit
e5ff0c39a6
|
@ -0,0 +1,26 @@
|
|||
fn evaluate _in: (addr handle cell), out: (addr handle cell), trace: (addr trace) {
|
||||
trace-text trace, "eval", "evaluate"
|
||||
trace-lower trace
|
||||
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
|
||||
break-if-=
|
||||
# nil is a literal
|
||||
copy-object _in, out
|
||||
trace-higher trace
|
||||
return
|
||||
}
|
||||
var in-type/ecx: (addr int) <- get in-addr, type
|
||||
compare *in-type, 1/number
|
||||
{
|
||||
break-if-!=
|
||||
# numbers are literals
|
||||
copy-object _in, out
|
||||
trace-higher trace
|
||||
return
|
||||
}
|
||||
copy-object _in, out
|
||||
trace-higher trace
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
# out is not allocated
|
||||
fn read-cell in: (addr gap-buffer), out: (addr handle cell), trace: (addr trace) {
|
||||
var tokens-storage: (stream cell 0x100)
|
||||
var tokens/ecx: (addr stream cell) <- address tokens-storage
|
||||
|
|
|
@ -174,9 +174,17 @@ fn run in: (addr gap-buffer), out: (addr stream byte), trace: (addr trace) {
|
|||
break-if-=
|
||||
return
|
||||
}
|
||||
# TODO: eval
|
||||
var eval-result-storage: (handle cell)
|
||||
var eval-result/edi: (addr handle cell) <- address eval-result-storage
|
||||
evaluate read-result, eval-result, trace
|
||||
var error?/eax: boolean <- has-errors? trace
|
||||
{
|
||||
compare error?, 0/false
|
||||
break-if-=
|
||||
return
|
||||
}
|
||||
clear-stream out
|
||||
print-cell read-result, out, trace
|
||||
print-cell eval-result, out, trace
|
||||
mark-lines-dirty trace
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue