下推自动机为(a ^ nb ^ n)^ mc ^ m

and*_*and 0 pushdown-automaton

我无法为这个自动机构建过渡函数.

我想我应该为每个a堆叠一个1并为每个b取出堆栈

c的数量等于ab对的数量,所以我想我应该为每个遇到的b堆叠一个0.事情是:我如何取消堆叠1并同时添加0?

jas*_*son 5

0每次遇到时都不要把它推到堆叠上b.相反,0每次遇到a时b,将堆栈推入堆栈,堆栈为空或堆栈顶部为a 0.

所以,使用你的命名法aabbabcc:

read a push 1
read a push 1
read b pop 1
read b pop 1
stack is empty so push 0
read a push 1
read b pop 1 
top of stack is 0 so push 0
read c pop 0
read c pop 0
Run Code Online (Sandbox Code Playgroud)

堆栈是空的,所以我们接受这个字符串.