Computer Science EngineeringVery hard
How many states does the LR(0) automaton (canonical collection of item sets, including the augmented production) have for the grammar S -> aS | b?
- A. 4
- B. 5
- C. 6
- D. 7
Correct answer: B. 5
The sets are I0, goto on S, a, b, and goto from the a-state on S, with a looping back to itself, giving 5 states.
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- For the grammar S -> aSb | c, what is FIRST(S)?
- Eliminating the left recursion from E -> E + T | T yields
- When a code generator has no free register and stores a live value to memory to free one, the process is called
- By the Sethi-Ullman labelling, the minimum number of registers needed to evaluate (a + b) (c + d) without spilling is
- By the maximal munch rule, how many tokens does a C scanner find in x = y+++z; ?
- When several lexemes could be matched by different Lex rules, Lex picks