Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
lfa:2022:lab11-cfl_3 [2022/12/18 21:36]
alexandra.udrescu01
lfa:2022:lab11-cfl_3 [2022/12/18 23:26] (current)
mihai.udubasa add some notes to 11.4.2
Line 45: Line 45:
 </​hidden>​ </​hidden>​
   * {{:​lfa:​2022:​lfa2022_lab6_mindfa2_1.png?​200|}}   * {{:​lfa:​2022:​lfa2022_lab6_mindfa2_1.png?​200|}}
-<​hidden><​note tip> $ S_1 \leftarrow 1S_2 | 0S_1 | \epsilon \\ S_2 \leftarrow 0S_1 | 1S_3 | \epsilon \\ S_3 \leftarrow 0S_3 | 1S_3$ </​note></​hidden +<​hidden><​note tip> $ S_1 \leftarrow 1S_2 | 0S_1 | \epsilon \\ S_2 \leftarrow 0S_1 | 1S_3 | \epsilon \\ S_3 \leftarrow 0S_3 | 1S_3$ </​note></​hidden>​
->+
  
 ===== 11.4. Short Exercises ===== ===== 11.4. Short Exercises =====
Line 54: 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>​