begin RAM, pushdown automaton
This commit is contained in:
parent
9260d34ae4
commit
b179cdf7ec
21
src/stack.asm
Normal file
21
src/stack.asm
Normal file
@ -0,0 +1,21 @@
|
||||
(5,2,5,5,0)
|
||||
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(9, 0, r8) // r8, address of stack top
|
||||
ADD(2, 0, r9) // r9 bottom symbol
|
||||
ADD(i1, 2, r2) // r2, address first automaton instruction begin state 'q', instruction: (q, a, A, w, q′)
|
||||
ADD(r2, 1, r3) // r3, address instruction read symbol 'a'
|
||||
ADD(r3, 1, r4) // r4, address instruction read stack symbol 'A'
|
||||
ADD(r4, 1, r5) // r5, address, instruction word pushed on stack length
|
||||
ADD(r5, i@r5, r6)
|
||||
ADD(1, r6, r6) // r6, address, next state q'
|
||||
|
||||
|
||||
JE(r0, i@r2, ) // current state is the expected state in the instruction
|
||||
|
||||
JE(i@r1, 2, ) // read symbol is epsilon
|
||||
JE(i@r3, i@r1, ) // symbol in input == read symbol
|
||||
JUMP()
|
||||
JE(i@r4, 2, ) // read stack symbol is epsilon
|
||||
JE(r@r6, i@r4, ) // stack top is the to expected symbol
|
||||
|
Loading…
x
Reference in New Issue
Block a user