Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
lfa:2022:lab11-cfl_3 [2022/12/18 21:41] mihai.udubasa |
lfa:2022:lab11-cfl_3 [2022/12/18 23:26] (current) mihai.udubasa add some notes to 11.4.2 |
||
---|---|---|---|
Line 53: | Line 53: | ||
Create a graph $math[G=(V,E)] where the nodes are **terminals and non-terminals**. For each rule of the form $math[X \leftarrow aY] create a directed edge $math[(X,Y)]. For each rule $math[X \leftarrow a], also generate an edge $math[(X,a)]. | Create a graph $math[G=(V,E)] where the nodes are **terminals and non-terminals**. For each rule of the form $math[X \leftarrow aY] create a directed edge $math[(X,Y)]. For each rule $math[X \leftarrow a], also generate an edge $math[(X,a)]. | ||
- First, we need to check first if the grammar generates a language different from $math[\emptyset]. So we check if there is a path from the start symbol to some terminal. | - First, we need to check first if the grammar generates a language different from $math[\emptyset]. So we check if there is a path from the start symbol to some terminal. | ||
- | - Second, we need to check if there are //loops//. It suffices to check if the graph is a tree. | + | - Second, we need to check if there are //loops//. It suffices to check if the graph is a tree. MU: the condition is not sufficient as a grammar could generate a finite language while also having looping rules (if the grammar comes from the dfa transformation, these would be from the sink states of the dfa; see state 3 of the second dfa from 11.3.1) |
</hidden> | </hidden> | ||
**11.4.3.** Prove that any DFA can be converted to a regular grammar. | **11.4.3.** Prove that any DFA can be converted to a regular grammar. | ||
- | <hidden> See lecture</hidden> | + | <hidden> See lecture </hidden> |
**11.4.4.** Is there a decidable algorithm to remove ambiguity from regular grammars? | **11.4.4.** Is there a decidable algorithm to remove ambiguity from regular grammars? | ||
<hidden> | <hidden> |