about summary refs log tree commit diff stats
path: root/apps/tile/rpn.mu
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tile/rpn.mu')
-rw-r--r--apps/tile/rpn.mu27
1 files changed, 4 insertions, 23 deletions
diff --git a/apps/tile/rpn.mu b/apps/tile/rpn.mu
index 4fec403c..79339918 100644
--- a/apps/tile/rpn.mu
+++ b/apps/tile/rpn.mu
@@ -1,5 +1,7 @@
-fn evaluate start: (addr word), end: (addr word), out: (addr int-stack) {
-  var curr/eax: (addr word) <- copy start
+fn evaluate defs: (addr function), scratch: (addr line), end: (addr word), out: (addr int-stack) {
+  var line/eax: (addr line) <- copy scratch
+  var word-ah/eax: (addr handle word) <- get line, data
+  var curr/eax: (addr word) <- lookup *word-ah
   var curr-text-storage: (stream byte 0x10)
   var curr-text/edi: (addr stream byte) <- address curr-text-storage
   clear-int-stack out
@@ -61,27 +63,6 @@ fn evaluate start: (addr word), end: (addr word), out: (addr int-stack) {
   }
 }
 
-fn test-evaluate {
-  # input = [1, 2, +]
-  var w: (handle word)
-  var wah/eax: (addr handle word) <- address w
-  allocate wah
-  var wa/eax: (addr word) <- lookup w
-  initialize-word-with wa, "1"
-  append-word-with w, "2"
-  var next/ecx: (addr handle word) <- get wa, next
-  append-word-with *next, "+"
-  # initialize output
-  var stack-storage: int-stack
-  var stack/edx: (addr int-stack) <- address stack-storage
-  initialize-int-stack stack, 0x10
-  #
-  evaluate wa, 0, stack
-  # check output
-  var x/eax: int <- pop-int-stack stack
-  check-ints-equal x, 3, "F - test-evaluate"
-}
-
 # Copy of 'simplify' that just tracks the maximum stack depth needed
 # Doesn't actually need to simulate the stack, since every word has a predictable effect.
 fn max-stack-depth first-word: (addr word), final-word: (addr word) -> result/edi: int {
nisanti/profani-tty/blame/.travis.yml?id=24784d9ea614383a725f198e49b00a2e7d0a6f88'>^
2b88e2f1 ^
ba22baba ^


c9a45d4d ^





ba22baba ^
e372ff9c ^
641eadd0 ^







e5787b95 ^
0fc0b3ee ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36