Parsing questions

Q26

GATE CS 2024 CS-1ParsingMSQ1 mark
Which of the following is/are Bottom-Up Parser(s)?
More than one option can be correct.
Show answer without attempting

Answer: A, D

Q40

GATE CS 2024 CS-2ParsingMCQ2 marks−2/3 if wrong
Consider the following context-free grammar where the start symbol is SS and the set of terminals is {a,b,c,d}\{a,b,c,d\}.

S→AaAb∣BbBaS \to AaAb \mid BbBa
A→cS∣ϵA \to cS \mid \epsilon
B→dS∣ϵB \to dS \mid \epsilon

The following is a partially-filled LL(1) parsing table.
aabbccdd$\$
SSS→AaAbS \to AaAbS→BbBaS \to BbBa(1)(2)
AAA→ϵA \to \epsilon(3)A→cSA \to cS
BB(4)B→ϵB \to \epsilonB→dSB \to dS
Which one of the following options represents the CORRECT combination for the numbered cells in the parsing table?

Note: In the options, "blank" denotes that the corresponding cell is empty.
Show answer without attempting

Answer: A

Q65

GATE CS 2024 CS-2ParsingNAT2 marks
Consider the following augmented grammar, which is to be parsed with a SLR parser. The set of terminals is {a,b,c,d,#,@}\{a,b,c,d,\#,@\}

S′→SS' \to S
S→SS∣Aa∣bAc∣Bc∣bBaS \to SS \mid Aa \mid bAc \mid Bc \mid bBa
A→d#A \to d\#
B→@B \to @

Let I0=CLOSURE({S′→∙S})I_0 = \text{CLOSURE}(\{S' \to \bullet S\}). The number of items in the set GOTO(I0,S)\text{GOTO}(I_0, S) is ___________
Show answer without attempting

Answer: 9

0/30 correct0 marks

Related topics in Compiler Design