search
Log In

Recent questions tagged syntax-directed-translation

47 votes
6 answers
1
In a bottom-up evaluation of a syntax directed definition, inherited attributes can always be evaluated be evaluated only if the definition is L-attributed be evaluated only if the definition has synthesized attributes never be evaluated
asked Sep 16, 2014 in Compiler Design Kathleen 13.5k views
6 votes
1 answer
2
The syntax of the repeat-until statement is given by the following grammar $S \rightarrow\text{ repeat }S_1\text{ until }E$ where E stands for expressions, $S$ and $S_1$ stand for statements. The non-terminals $S$ and $S_1$ have an attribute code that represents ... a statement. Use the operator '\\' to concatenate two strings and the function gen(s) to generate a line containing the string s.
asked Sep 15, 2014 in Compiler Design Kathleen 690 views
14 votes
3 answers
3
Consider the syntax directed translation scheme (SDTS) given in the following. Assume attribute evaluation with bottom-up parsing, i.e., attributes are evaluated immediately after a reduction. E$\rightarrow $ E$_{1}$ * T {E.val = E$_{1}$ ... modify the SDTS given, without changing the grammar, to find $E.red$, the number of reductions performed while reducing an input to $E$.
asked Sep 14, 2014 in Compiler Design Kathleen 2.2k views
10 votes
1 answer
4
Write syntax directed definitions (semantic rules) for the following grammar to add the type of each identifier to its entry in the symbol table during semantic analysis. Rewriting the grammar is not permitted and semantic rules are to be added to the ends of productions only. $D \rightarrow TL;$ $T \rightarrow \text{int}$ $T \rightarrow \text{real}$ $L \rightarrow L,id$ $L \rightarrow id$
asked Sep 13, 2014 in Compiler Design Kathleen 1.1k views
...