Define Rn to be the maximum amount earned by cutting a rod of length n meters into one or more pieces of integer length and selling them. For i > 0, let p[i] denotes the selling price of a rod whose length is i meters. Consider the array of prices:
p[1] = 1, p[2] = 5, p[3] = 8, p[4] = 9, p[5] = 10, p[6] = 17, p[7] = 18
Which of the following statements is/are correct about R7?
Consider the following statements.
S1 : Every SLR(1) grammar is unambiguous but there are certain unambiguous grammars that are not SLR(1).
S2 : For any context-free grammar, there is a parser that takes at most O(n3) time to parse a string of length n.
Which one of the following option is correct?
Consider the following context-free grammar where the set of terminals is {a, b, c, d, f}.
S → d a T | R f
T → a S | b a T | ϵ
R → c a T R | ϵ
The following is a partially-filled LL(1) parsing table.
Which one of the following choices represents the correct combination for the numbered cells in the parsing table ("blank" denotes that the corresponding cell is empty)?
Consider the following grammar (that admits a series of declarations, followed by expressions) and the associated syntax directed translation (SDT) actions, given as pseudo-code:
P → D* E*
D → int ID {record that ID.lexeme is of type int}
D → bool ID { record that ID.lexeme is of type bool}
E → E1 + E2 {check that E1.type = E2.type = int; set E.type := int}
E → !E1 {check that E1.type = bool; set E.type := bool}
E → ID {set E.type := int}
With respect to the above grammar; which one of the following choices is correct?