fix stack top address

This commit is contained in:
Sam Hadow 2024-04-09 18:55:24 +02:00
parent fa92ee4364
commit 899ee54064

View File

@ -1,7 +1,7 @@
(37, 6, 0, 0, 0, 1, 1, 1, 0, 0, 3, 2, 1, 3, 0, 0, 0, 1, 2, 1, 1, 0, 0, 1, 0, 0, 2, 2, 1, 0, 0, 2, 2, 2, 3, 1, 3, 1)
ADD(0, 0, r0) // r0 current state in pushdown automaton
ADD(2, 0, r1) // r1 cursor position in input word, (i2 first symbol of input word, i1 length of input word)
ADD(11, 0, r11) // r11 address of stack top
ADD(12, 0, r11) // r11 address of stack top
ADD(3, 0, r12) // r12 bottom symbol
ADD(i0, 1, r7) // r7 address registry after last instruction in input
ADD(i1, 2, r10) // r10 last symbol of input word address + 1
@ -51,8 +51,8 @@ JUMP(7) // go to copy word on stack
ADD(i@r6, 0, r0) // a=symbol, A=symbol
ADD(r1, 1, r1) // move cursor in input word
JE(i@r5, 0, 2) // check if word to copy is empty
JUMP(3) // go to copy word on stack
SUB(r11, 1, r11)
JUMP(2) // go to copy word on stack
JUMP(-38) // restart loop
SUB(r6, 1, r9) // address symbol to copy on stack