Consider the following two syntax-directed definitions SDD1 and SDD2 for type
declarations.
π· is the start symbol, and πππ‘, πππππ‘ and ππ are the three terminals. The non-terminal
π1 is the same as π and the non-terminal π·1 is the same as π·. Here, the subscript is
used to differentiate the grammar symbols on the two sides of a production. The
function ππ’π‘ updates the symbol table with the type information for an identifier.
Let P and Q be the languages specified by grammars G1 and G2, respectively.
Which of the following statements is/are true?
SDD1
Grammar
(G1)
Semantic Rules
π· βπ π
π·. π‘π¦ππ = π. π‘π¦ππ
π. π‘π¦ππ = π. π‘π¦ππ
π β πππ‘
π. π‘π¦ππ = πππ‘
π β πππππ‘
π. π‘π¦ππ = πππππ‘
πβπ1 ππ
π1. π‘π¦ππ= π. π‘π¦ππ
ππ’π‘(ππ. πππ‘ππ¦, π. π‘π¦ππ)
π β ππ
ππ’π‘(ππ. πππ‘ππ¦, π. π‘π¦ππ)
SDD2
Grammar
(G2)
Semantic Rules
π·βπ·1 ππ
π·. π‘π¦ππ= π·1. π‘π¦ππ
ππ’π‘(ππ. πππ‘ππ¦, π·1. π‘π¦ππ)
π· β π ππ
π·. π‘π¦ππ = π. π‘π¦ππ
ππ’π‘(ππ. πππ‘ππ¦, π. π‘π¦ππ)
π βπππ‘
π. π‘π¦ππ = πππ‘
π β πππππ‘
π. π‘π¦ππ = πππππ‘
This question compares two syntax directed definitions (SDDs) for type-declaration statements and asks which claims about the generated languages, the nature of the attributes used, and the resulting symbol-table entries are correct.
Step 1: Language generated by G1 and G2. In G1, \(D \to T\ V\) with \(V \to V_1\ id \mid id\). Since \(V\) recursively appends one \(id\) at a time, \(V\) derives one or more identifiers, so \(D\) derives \(T\) followed by one or more \(id\)'s. In G2, \(D \to D_1\ id \mid T\ id\), which is again left recursive: the base case \(T\ id\) gives a single identifier, and each further application of \(D \to D_1\ id\) appends one more identifier. Both grammars therefore generate exactly the language \(\{T\ id^n : n \geq 1\}\), so \(P = Q\). Statement (A) is true.
Step 2: Attribute classification in SDD1. For \(T \to int\) and \(T \to float\), \(T.type\) is computed purely from the terminal, so it is synthesized. For \(D \to T\ V\), \(D.type = T.type\) is synthesized from the child \(T\), but \(V.type = T.type\) copies a value from the sibling \(T\) down into \(V\), which makes \(V.type\) an inherited attribute. The recursive rule \(V \to V_1\ id\) sets \(V_1.type = V.type\), pushing this inherited value further down. So SDD1 mixes synthesized attributes (\(T.type\), \(D.type\)) with inherited attributes (\(V.type\), \(V_1.type\)); it is L-attributed overall but does not contain only inherited attributes. Statement (C) is false.
Step 3: Attribute classification in SDD2. Here \(D.type = T.type\) or \(D.type = D_1.type\), and \(T.type\) is set directly from the terminal. Every attribute value comes strictly from the children of the production - no value is ever pushed from a parent down into an already-expanded child. This means SDD2 uses only synthesized attributes, i.e. it is S-attributed. Statement (B) is true.
Step 4: Symbol table entries. In SDD1 the single declared type is fixed once from \(T\), threaded down as an inherited attribute through every \(V\)/\(V_1\), and \(put(id.entry, V.type)\) inserts each identifier with that same type. In SDD2 the same declared type is synthesized upward through the chain of \(D_1\) reductions, and \(put(id.entry, D_1.type)\) or \(put(id.entry, T.type)\) again inserts each identifier with that type. For a declaration such as \(int\ a\ b\ c\), both SDDs end up calling \(put\) once per identifier, mapping every identifier to the same declared type. So the entries placed in the symbol table are identical between the two definitions. Statement (D) is true.
Hence the correct statements are (A), (B), and (D).
\[\boxed{\text{Answer: (A), (B), (D)}}\]A schedule of three database transactions \(T_1\), \(T_2\), and \(T_3\) is shown. \(R_i(A)\) and \(W_i(A)\) denote read and write of data item A by transaction \(T_i\), \(i = 1, 2, 3\). The transaction \(T_1\) aborts at the end. Which other transaction(s) will be required to be rolled back?

A lexical analyzer uses the following token definitions
ο· πππ‘π‘ππβ[π΄βππβπ§]
ο· πππππ‘β[0 β9]
ο· ππβπππ‘π‘ππ (πππ‘π‘ππ | πππππ‘)*
ο· ππ’ππππβπππππ‘+
ο· π€π β(πππππ | π‘ππ | πππ€ππππ)+
For the string given below,
π₯1 23ππ 78 π¦ 7π§ π§π§5 14π΄ 8π» π΄ππππ·
the number of tokens (excluding π€π ) that will be produced by the lexical analyzer
is __________. (answer in integer)
Which of the following statements is/are true?