Recent questions tagged ullman

1 1 vote
0 0 answers
1.5k
1.5k views
Construct a syntax-directed translation scheme that translates arithmetic expressions from postfix notation into infix notation. Give annotated parse trees for the inputs...
1 1 vote
1 1 answer
4.8k
4.8k views
Construct a syntax-directed translation scheme that translates arithmetic expressions from infix notation into prefix notation in which an operator appears before its ope...
1 1 vote
0 0 answers
463
463 views
Construct a context-free grammar for roman numerals.
0 0 votes
0 0 answers
696
696 views
Show that all binary strings generated by the following grammar havevalues divisible by $3$. Hint. Use induction on the number of nodes in a parse tree. $$num\rightarrow ...
0 0 votes
0 0 answers
865
865 views
Construct unambiguous context-free grammars for each of the following languages. In each case show that your grammar is correct. Arithmetic expressions in postfix notatio...
1 1 vote
3 3 answers
1.7k
1.7k views
Which of the grammars are ambiguous? $S\rightarrow 0S1 \mid 01$$S\rightarrow +SS \mid -SS \mid a$$S\rightarrow S(S)S \mid \epsilon$$S\rightarrow aSbS \mid bSaS \mid \epsi...
0 0 votes
0 0 answers
490
490 views
What language is generated by the following grammars? In each case justify your answer. $S\rightarrow 0S1 \mid 01$$S\rightarrow +SS \mid -SS \mid a$$S\rightarrow S(S)S \m...
0 0 votes
0 0 answers
369
369 views
Consider the context-free grammar$S\rightarrow SS+\mid SS^{\ast}\mid a$Show how the string $aa+a^{\ast}$ can be generated by this grammar.Construct a parse tree for this ...
0 0 votes
1 1 answer
452
452 views
What is printed by the following C code?#define a (x+1) int x = 2; void b() {x = a; printf("%d\n",x);} void c() {int x = 1; printf("%d\n"),a;} void main() {b(); c();}
0 0 votes
0 0 answers
333
333 views
For the block-structured code, assuming the usual static scoping of declarations, give the scope for each of the twelve declarations.{ int w,x,y,z; /* Block B1 */ { int x...
0 0 votes
0 0 answers
270
270 views
For the block-structured C code, indicate the values assigned to $w,x,y$ and $z$.int w,x,y,z; int i = 3; int j = 4; { int i = 5; w = i + j; } x = i + j; { int j = 6; i =...
0 0 votes
0 0 answers
335
335 views
For the block-structured C code, indicate the values assigned to $w, x, y$, and $z$. int w,x,y,z; int i = 4; int j = 5; { int j = 7; i = 6; w = i + j; } x = i + j; { int ...
0 0 votes
0 0 answers
498
498 views
Indicate which of the following terms:imperative declarative von Neumannobject-oriented functional third-generationfourth-generation scriptingapply to which of the follo...
1 1 vote
0 0 answers
525
525 views
It is undecidable whether the complement of a CFL is also a CFL. Exercise $9.5.2$ can be used to show it is undecidable whether the complement of a CFL is regular, but th...
0 0 votes
0 0 answers
579
579 views
Show that the language $\overline{L_A}\cup \overline{L_B}$ is a regular language if and only if it is the set of all strings over its alphabet;i.e., if and only if the in...
0 0 votes
0 0 answers
492
492 views
Let $L$ be the set of (codes for) context-free grammars $G$ such that $L(G)$ contains at least one palindrome. Show that $L$ is undecidable. Hint: Reduce PCP to $L$ by co...
0 0 votes
0 0 answers
460
460 views
A Post tag system consists of a set of pairs of strings chosen from some finite alphabet $\Sigma$ and a start string. If $(w,x)$ is a pair, and $y$ is any string over $\S...
0 0 votes
0 0 answers
285
285 views
Suppose we limited $PCP$ to a one-symbol alphabet, say $\Sigma = \left\{0\right\}$. Would this restricted case of $PCP$ still be undecidable?
0 0 votes
0 0 answers
337
337 views
We showed that $PCP$ was undecidable, but we assumed that the alphabet $\Sigma$ could be arbitrary. Show that $PCP$ is undecidable even if we limit the alphabet to $\Sigm...
0 0 votes
0 0 answers
302
302 views
Tell whether each of the following instances of $PCP$ has a solution. Each is presented as two lists $A$ and $B$, and the $i^{th}$ strings on the two lists correspond for...
0 0 votes
0 0 answers
390
390 views
Tell whether each of the following are recursive, RE-but-not-recursive, or non-RE.The set of all $TM$ codes for $TM's$ that halt on every input.The set of all $TM$ codes ...
0 0 votes
0 0 answers
409
409 views
Show that the following problems are not recursively enumerable:The set of pairs $(M,w)$ such that $TM \ M$, started with input $w$, does not halt.The set of pairs $(M_{1...
0 0 votes
0 0 answers
320
320 views
Show that the following questions are decidable:The set of codes for $TM's \ M$ such that when started with blank tape will eventually write some nonblank symbol on its t...
0 0 votes
0 0 answers
329
329 views
Let $L$ be the language consisting of pairs of $TM$ codes plus an integer, $(M_{1},M_{2},k)$, such that $L(M_{1})\cap L(M_{2})$ contains at least $k$ strings. Show that $...
0 0 votes
1 1 answer
601
601 views
We know by Rice's theorem that none of the following problems are decidable. However are they recursively enumerable,or non-RE?Does $L(M)$ contain at least two strings?Is...
0 0 votes
0 0 answers
356
356 views
Show that the language of codes for $TM's\ M$ that, when started with blank tape, eventually write a $1$ somewhere on the tape is undecidable.
0 0 votes
0 0 answers
370
370 views
The Big Computer Corp. has decided to bolster its sagging market share by manufacturing a high-tech version of the Turing machine called, $BWTM$ that is equipped with bel...
0 0 votes
0 0 answers
464
464 views
Show that the set of Turing-machine codes for TM's that accept all inputs that are palindromes (possibly along with some other inputs) is undecidable.
0 0 votes
0 0 answers
339
339 views
We have not discussed closure properties of the recursive languages or the RE languages other than our discussion of complementation in Section $9.2.2.$ Tell whether the ...
0 0 votes
0 0 answers
267
267 views
Let $L$ be recursively enumerable and let $\overline{L}$ be non-RE. Consider the language$L' = \left\{0w\mid w\ \text{is in}\ L \right\}$Can you say for certain whether $...