recategorized by
1,043 views
5 votes
5 votes

Suppose we have a computer with single register and only three instructions given below:
$$\begin{array}{ll} \text{LOAD addren}  &  \text{; load register} \\ \text{} & \text{; from addren}\\ \text{STORE addren} & \text{; store register}\\ \text{} & \text{; at addren}\\ \text{ADD addren} & \text{; add register to}\\  \text{} & \text{; contents of addren}\\  \text{} & \text{; and place the result}\\    \text{} & \text{; in the register}\\  \end{array}$$
Consider the following grammar:

  • $A \rightarrow id : =E$
  • $E \rightarrow E+T\mid T$
  • $T \rightarrow (E)\mid id$

 Write a syntax directed translation to generate code using this grammar for the computer described above.

recategorized by

Please log in or register to answer this question.

Related questions

1.4k
views
1 answers
4 votes
Kathleen asked Sep 29, 2014
1,436 views
The language $L,$ defined by the following grammar, allows use of real or integer data in expressions and assignment statements.<assign-stmt> :: <LHS> := < ... making the function calls' give_name $(id)$ and give_type $(id)$ respectively.
5.2k
views
3 answers
16 votes
Kathleen asked Oct 5, 2014
5,162 views
A grammar $G$ is in Chomsky-Normal Form (CNF) if all its productions are of the form $A \to BC$ or $A \to a$, where $A,B$ and $C$, are non-terminals and $a$ is ... string in $L(G)$ of length $n$, then how long is a derivation of $w$ in $G$?
770
views
1 answers
1 votes
makhdoom ghaya asked Dec 5, 2016
770 views
Consider the following grammar for variable declarations:<vardecl> $\rightarrow$ <vardecl><idlist> : <type>;<vardecl> $\rightarrow \in$ ... procedures operating on the symbol table; you need not elaborate upon these procedures.
699
views
1 answers
1 votes
makhdoom ghaya asked Nov 26, 2016
699 views
Consider the grammar:$G_{2}$:Para $\rightarrow$ Sentence RP | SentenceRP $\rightarrow$ b Sentence RP | b SentenceSentence $\rightarrow$ ... $id*id\;b\; id * id$The parse should generate a rightmost derivation.