InferenceAI

Enter at least two characters to search.

Start free

Compiler Design

Lexical analysis, parsing, syntax-directed translation, intermediate code and optimisation. 8 questions with worked solutions.

Q1MCQ1 markLexical analysis

Lexical analysers are usually implemented using:

Q2NAT1 markLexical analysis

How many tokens are in the C statement int x = a + 10;?

Q3MCQ1 markParsing

Which grammar property makes a grammar unsuitable for LL(1) parsing?

Q4MCQ1 markParsing

Which of these LR parsers is the most powerful (accepts the largest class of grammars)?

Q5MCQ1 markSyntax-directed translation

A syntax-directed definition that uses only synthesised attributes is called:

Q6NAT2 marksFirst and follow sets

For the grammar S→ABS \to AB, A→a∣εA \to a \mid \varepsilon, B→b∣εB \to b \mid \varepsilon, how many elements are in FIRST(S)\text{FIRST}(S), counting ε\varepsilon?

Q7MCQ1 markOptimisation

Which structure is most directly used to detect common subexpressions within a basic block?

Q8MCQ1 markRuntime environments

Where are local variables of a recursive function normally stored?