Differences
This shows you the differences between two versions of the page.
| lfa:2023:lab10 [2023/12/18 22:26] mihai.udubasa created | lfa:2023:lab10 [2024/01/16 22:32] (current) alexandra.udrescu01 | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| - | /* | + | |
| <hidden Solution> | <hidden Solution> | ||
| The start symbol of the PDA is S. \\ The PDA will only have one state q and it will accept via empty stack. \\ | The start symbol of the PDA is S. \\ The PDA will only have one state q and it will accept via empty stack. \\ | ||
| Line 33: | Line 33: | ||
| Repaired grammar: \\ $ S \leftarrow aS | A \\ A \leftarrow aAb | \epsilon $ | Repaired grammar: \\ $ S \leftarrow aS | A \\ A \leftarrow aAb | \epsilon $ | ||
| </hidden> | </hidden> | ||
| - | */ | + | |
| Line 44: | Line 44: | ||
| - | /* | + | |
| <hidden Solution> | <hidden Solution> | ||
| The PDA has the following transitions looping on state q: | The PDA has the following transitions looping on state q: | ||
| Line 73: | Line 73: | ||
| $ S \leftarrow TbS | T \\ T \leftarrow cT | xAz | a \\ A \leftarrow SyS | SyStS $ \\ | $ S \leftarrow TbS | T \\ T \leftarrow cT | xAz | a \\ A \leftarrow SyS | SyStS $ \\ | ||
| </hidden> | </hidden> | ||
| - | */ | + | |
| Line 83: | Line 83: | ||
| - | /* | + | |
| <hidden Solution> | <hidden Solution> | ||
| The PDA has the following transitions looping on state q: | The PDA has the following transitions looping on state q: | ||
| Line 106: | Line 106: | ||
| The accepted language is $ L(G) = \{a^{m}b^{2n + 1}c^{p+1} | m,n,p \ge 0\} $ \\ | The accepted language is $ L(G) = \{a^{m}b^{2n + 1}c^{p+1} | m,n,p \ge 0\} $ \\ | ||
| </hidden> | </hidden> | ||
| - | */ | + | |
| Line 118: | Line 118: | ||
| - | /* | + | |
| <hidden Solution>  | <hidden Solution>  | ||
| Although the entire string is matched by PAIRS and NO_CONSEC_ONE, PAIRS is defined first, thus it will be the first picked. \\ | Although the entire string is matched by PAIRS and NO_CONSEC_ONE, PAIRS is defined first, thus it will be the first picked. \\ | ||
| Line 125: | Line 125: | ||
| </hidden> | </hidden> | ||
| - | */ | + | |
| * 1010101011 | * 1010101011 | ||
| - | /* | + | |
| <hidden Solution>  | <hidden Solution>  | ||
| First we have a maximal match on "101010101" for regex NO_CONSEC_ONE. The remaining string, "1", is matched by both ONES and NO_CONSEC_ONE, but ONES is defined first. \\ | First we have a maximal match on "101010101" for regex NO_CONSEC_ONE. The remaining string, "1", is matched by both ONES and NO_CONSEC_ONE, but ONES is defined first. \\ | ||
| NO_CONSEC_ONE "101010101" \\ ONES "1" | NO_CONSEC_ONE "101010101" \\ ONES "1" | ||
| </hidden> | </hidden> | ||
| - | */ | + | |
| * 01110101001 | * 01110101001 | ||
| - | /* | + | |
| <hidden Solution> | <hidden Solution> | ||
| PAIRS "01" \\ | PAIRS "01" \\ | ||
| Line 144: | Line 144: | ||
| NO_CONSEC_ONES "0101001" | NO_CONSEC_ONES "0101001" | ||
| </hidden> | </hidden> | ||
| - | */ | + | |
| * 01010111111001010 | * 01010111111001010 | ||
| - | /* | + | |
| <hidden> | <hidden> | ||
| PAIRS "010101" \\ | PAIRS "010101" \\ | ||
| Line 154: | Line 154: | ||
| NO_CONSEC_ONES "001010" | NO_CONSEC_ONES "001010" | ||
| </hidden>  | </hidden>  | ||
| - | */ | + | |
| * 1101101001111100001010011001 | * 1101101001111100001010011001 | ||
| - | /* | + | |
| <hidden> | <hidden> | ||
| ONES "11" | ONES "11" | ||
| Line 166: | Line 166: | ||
| PAIRS "1001" | PAIRS "1001" | ||
| </hidden> | </hidden> | ||
| - | */ | + | |