i'm running into some problem for my research in computer science theories...
Can any one explain me the algorithm that how we can convert a context-free grammar(cfg) to corresponding push down automata(pda) With just 2 state ?
i'm running into some problem for my research in computer science theories...
Can any one explain me the algorithm that how we can convert a context-free grammar(cfg) to corresponding push down automata(pda) With just 2 state ?
State 1: Not accepting. Push S onto the empty stack by empty transition to self. Empty transition to self for each production in G, but push produced string onto stack backwards. Empty transition to self upon reading terminal symbol x with x on top of the stack. Empty transition to state 2 on empty stack.
State 2: Accepts on no more input and empty stack.
Theory of operation: the stack is used to derive strings in the language of the grammar by writing out derivations backwards and then popping them off when reading input. If you run out of input and the stack is empty, you can go to state 2 and accept.