Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the sentence to define ambiguity in grammars.
Compiler Design
A grammar is ambiguous if it can generate a string with [1] parse trees.
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'one' because a grammar usually has one parse tree per string.
✗ Incorrect
A grammar is ambiguous if there is more than one parse tree for the same string.
2fill in blank
mediumComplete the sentence about ambiguity's effect on parsing.
Compiler Design
Ambiguity in a grammar makes it difficult to [1] the structure of sentences.
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'simplify' because ambiguity actually complicates parsing.
✗ Incorrect
Ambiguity makes it hard to determine the correct structure or meaning of sentences.
3fill in blank
hardFix the error in the statement about ambiguous grammars.
Compiler Design
An ambiguous grammar has [1] parse trees for some string.
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'one' because many grammars have one parse tree per string.
✗ Incorrect
Ambiguous grammars have multiple parse trees for at least one string, not just one.
4fill in blank
hardFill both blanks to describe ambiguity in grammar rules.
Compiler Design
If a grammar allows [1] different parse trees for the same string, it is called [2].
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing up 'unique' and 'ambiguous'.
✗ Incorrect
Multiple parse trees for the same string means the grammar is ambiguous.
5fill in blank
hardFill all three blanks to complete the explanation of ambiguity.
Compiler Design
Ambiguity can cause [1] in [2] and make [3] difficult.
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'execution' instead of 'compilation'.
✗ Incorrect
Ambiguity causes confusion in parsing and makes compilation difficult.