Automata theory : Conversion of a Context free grammar to a DFA

泪湿孤枕 提交于 2019-12-11 02:06:24

问题


How to convert a Context Free Grammar to a DFA? This is easy if we have transitions like A->a B. But when we have the transitions as A->a B c. Then how should we represent it as a DFA


回答1:


First, you should convert your language to CNF (Chomskey Normal Form). Then steps for conversion are as such:

  1. Convert it to left/right grammar is called a regular grammar.

  2. Convert the Regular Grammar into Finite Automata The transitions for automata are obtained as follows For every production A -> aB make δ(A, a) = B that is make an are labeled ‘a’ from A to B. For every production A -> a make δ(A, a) = final state. For every production A -> ϵ, make δ(A, ϵ) = A and A will be final state.



来源:https://stackoverflow.com/questions/22741321/automata-theory-conversion-of-a-context-free-grammar-to-a-dfa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!