2

I need to write the CFG that generate to the following automata.

I know that a transition like this:

-es, es; S lead to a rule like S-> es
-es, B; es lead to a rule like B -> es
-es, B; aB lead to a rule like B-> aB

es stands for empty string.

But I have don't know how to deal with rules like "c, a; a". Anyone can give me any help? Thank you.

http://tonguim.free.fr/divers/automata.jpg

1 Answers1

0

Generally speaking, each production is a finite state machine that shows the parser's progress through that production.

The stack used by the automaton is a stack of such production states. Every time you descend into a production, you push on its initial state. Every time you conclude one, you pop its now-final state off. Terminals can be viewed as degenerate productions whose state machines have a single state.

phs
  • 10,687
  • 4
  • 58
  • 84
  • Thanks @phs for your answer. Please can you give an example because your explanation didn't help me much? Thank you. – Orion Orion Mar 09 '12 at 01:39
  • http://en.wikipedia.org/wiki/Pushdown_automaton#PDA_and_Context-free_Languages says it well. The rest of the page has some examples also. – phs Mar 09 '12 at 03:27