1
교수님이 준 문법입니다. Finite State Automaton이 정의한 문자열을 인식하도록 설정되었습니다. 입력의 가장 긴 유효 접두사를 인식하도록 변형되어야합니다.FA 시뮬레이션 알고리즘 문제
//This would output valid if the whole string is valid not the longest
read input;
state = init;
while not end of input
{
state = move(state,symbol);
readnextInput();
}
if state is in (F):Final States print (valid);
else print(invalid);
while 조건에 "& state is in (F)
"을 추가하려고했습니다. 그러나 이것은 유효한 최단 프리픽스를 인식 할 것입니다.
여기에서 문제가 될 수있는 것은 무엇입니까? 스택을 정의하고 각 문자열을 최종 상태에 도달 할 때마다 밀어 넣고 마지막 하나를 솔루션으로 표시해야합니까?
문법을 표시 할 수 있습니까? – Marichyasana