automaton auto1{
states q0,q1,q2,q3,q4,q5,q6;
alphabet a,b;
initial q0;
final q5,q6;
transition{
q0,$=q1;
q0,$=q3;
q1,a=q1;
q1,b=q2;
q2,$=q5;
q2,b=q6;
q2,a=q6;
q3,a=q4;
q4,b=q4;
q4,$=q5;
q5,$=q0;
}
}
pdautomaton pila1{
states q0,q1;
alphabet a,b;
stack A,B,Z0;
initial q0;
stackinitial Z0;
transition{
q0,a,(Z0)=q0,(A,Z0);
q0,a,(A)=q0,(A,A);
q0,b,(A)=q1,($);
q1,b,(A)=q1,($);
q1,$,(Z0)=q1,($);
}
}
/*
ENG: First we print the automaton and the stack automaton.
ESP: Primero imprimimos el automata y el automata a pila.
*/
print(auto1);
print(pila1);
/*
ENG: Now we will see if the automaton and the stack automaton
recognize the string [a a a b b b].
ESP: Ahora veremos si el automata y el automata a pila
reconocen la cadena [a a a b b b].
*/
visualrecognize(auto1,a a a b b b);
visualrecognize(pila1,a a a b b b);