Login
Register
Dark Mode
Brightness
Ambient Glow – Questions list
Register
Profile
Edit Profile
Messages
My favorites
My Updates
Logout
Recent questions tagged context-free-grammar
0
0 votes
0
0 answers
353
353 views
Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 10 (Page No. 233)
Show how, having filled in the table as in Question $4.4.9$, we can in $O(n)$ time recover a parse tree for $a_{1}a_{2}\cdot\cdot\cdot a_{n}$. Hint: modify the table so i...
admin
353
views
asked
Aug 20, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
descriptive
+
–
0
0 votes
0
0 answers
447
447 views
Ullman (Compiler Design) Edition 2 Exercise 4.4 Question 9 (Page No. 232)
Every language that has a context-free grammar can be recognized in at most $O(n^{3})$ time for strings of length $n$. A simple way to do so,called the Cocke- Younger-Ka...
admin
447
views
asked
Aug 20, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
cyk-algorithm
descriptive
+
–
0
0 votes
0
0 answers
630
630 views
Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 3 (Page No. 207)
Design grammars for the following languages:The set of all strings of $0's$ and $1's$ such that every $0$ is immediately followed by at least one $1$.The set of all strin...
admin
630
views
asked
Aug 17, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
descriptive
+
–
2
2 votes
0
0 answers
1.1k
1.1k views
Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 2 (Page No. 206 - 207)
Repeat Question $4.2.1$ for each of the following grammars and strings: $S\rightarrow 0S1\mid 01$ with string $000111$.$S\rightarrow +SS\mid \ast SS\mid a$ with string $+...
admin
1.1k
views
asked
Aug 17, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
parsing
ambiguous
descriptive
+
–
6
6 votes
1
1 answer
13.9k
13.9k views
Ullman (Compiler Design) Edition 2 Exercise 4.2 Question 1 (Page No. 206)
Consider the context-free grammar:$$S\rightarrow SS + \mid SS {\ast} \mid a$$and the string $aa + a{\ast}$.Give a leftmost derivation for the string.Give a rightmost deri...
admin
13.9k
views
asked
Aug 7, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
parsing
ambiguous
descriptive
+
–
1
1 vote
0
0 answers
455
455 views
Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 6 (Page No. 52)
Construct a context-free grammar for roman numerals.
admin
455
views
asked
Jul 26, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
+
–
0
0 votes
0
0 answers
861
861 views
Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 4 (Page No. 51 - 52)
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...
admin
861
views
asked
Jul 26, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
+
–
1
1 vote
3
3 answers
1.7k
1.7k views
Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 3 (Page No. 51)
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...
admin
1.7k
views
asked
Jul 26, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
ambiguous
+
–
0
0 votes
0
0 answers
484
484 views
Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 2 (Page No. 51)
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...
admin
484
views
asked
Jul 26, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
+
–
0
0 votes
0
0 answers
366
366 views
Ullman (Compiler Design) Edition 2 Exercise 2.2 Question 1 (Page No. 51)
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 ...
admin
366
views
asked
Jul 26, 2019
Compiler Design
ullman
compiler-design
context-free-grammar
+
–
0
0 votes
0
0 answers
484
484 views
Ullman (TOC) Edition 3 Exercise 9.5 Question 1 (Page No. 418)
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...
admin
484
views
asked
Jul 26, 2019
Theory of Computation
ullman
theory-of-computation
context-free-grammar
pcp
descriptive
+
–
0
0 votes
0
0 answers
621
621 views
Peter Linz Edition 4 Exercise 7.4 Question 9 (Page No. 204)
Give LL grammars for the following languages, assuming $Σ =$ {$a,b, c$}.(i) $L=$ {$a^nb^mc^{n+m}:n\geq0,m\geq0$} .(ii) $L=$ {$a^{n+2}b^mc^{n+m}:n\geq0,m\geq0$} .(iii) $L=...
Naveen Kumar 3
621
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-language
context-free-grammar
+
–
1
1 vote
1
1 answer
525
525 views
Peter Linz Edition 4 Exercise 7.4 Question 8 (Page No. 204)
Let G be a context-free grammar in Greibach normal form. Describe an algorithm which, for anygiven k, determines whether or not G is an LL (k) grammar.
Naveen Kumar 3
525
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-grammar
+
–
0
0 votes
0
0 answers
445
445 views
Peter Linz Edition 4 Exercise 7.4 Question 6 (Page No. 204)
Show that if G is an LL (k) grammar, then L (G) is a deterministic context-free language.
Naveen Kumar 3
445
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-grammar
context-free-language
+
–
0
0 votes
0
0 answers
382
382 views
Peter Linz Edition 4 Exercise 7.4 Question 5 (Page No. 204)
Show that any LL grammar is unambiguous.
Naveen Kumar 3
382
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-grammar
context-free-language
+
–
0
0 votes
1
1 answer
519
519 views
Peter Linz Edition 4 Exercise 7.4 Question 4 (Page No. 204)
Construct an LL grammar for the language L (a*ba) ∪ L (abbb*).
Naveen Kumar 3
519
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-grammar
context-free-language
+
–
0
0 votes
0
0 answers
329
329 views
Peter Linz Edition 4 Exercise 7.4 Question 3 (Page No. 204)
Find an LL grammar for the language L = {$w : n_a (w) = n_b (w)$}.
Naveen Kumar 3
329
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-grammar
context-free-language
+
–
0
0 votes
1
1 answer
585
585 views
Peter Linz Edition 4 Exercise 7.4 Question 2 (Page No. 204)
Show that the grammar for L = {$w : n_a (w) = n_b (w)$} which is, $S\rightarrow SS,S\rightarrow \lambda,S\rightarrow aSb,S\rightarrow bSa$ is not an LL grammar.
Naveen Kumar 3
585
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-language
context-free-grammar
+
–
0
0 votes
0
0 answers
361
361 views
Peter Linz Edition 4 Exercise 7.4 Question 1 (Page No. 204)
Show that the grammar $S_0\rightarrow aSbS,S\rightarrow aSbS|\lambda$ is an LL grammar and that it is equivalent to the grammar $S\rightarrow SS|aSb|ab$.
Naveen Kumar 3
361
views
asked
Jun 25, 2019
Theory of Computation
peter-linz
peter-linz-edition4
theory-of-computation
context-free-grammar
+
–
1
1 vote
2
2 answers
1.4k
1.4k views
ACE Academy: Recognition of CFG
$L1 =\left \{ a^{m} b^{n} c^{p} | \left ( m \geq n \right )\text{or} \left ( n = p \right ) \right \}$ $L2 =\left \{ a^{m} b^{n} c^{p} | \left ( m \geq n \right )\text{a...
Hirak
1.4k
views
asked
May 22, 2019
Theory of Computation
context-free-grammar
context-free-language
dcfl
+
–
3
3 votes
2
answers
2 answers
1.2k
1.2k views
ISI2018-PCB-CS4
Let the valid moves along a staircase be $U$ (one step up) and $D$ (one step down). For example, the string $s = UUDU$ represents the sequence of moves as two steps up, t...
akash.dinkar12
1.2k
views
asked
May 12, 2019
Theory of Computation
isi2018-pcb-cs
theory-of-computation
context-free-grammar
descriptive
+
–
0
0 votes
1
1 answer
617
617 views
Michael Sipser Edition 3 Exercise 2 Question 28 (Page No. 157)
Give unambiguous $CFG's$ for the following languages$.$$\text{{$w\mid$ in every prefix of $w$ the number of $a’s$ is at least the number of $b’s$}}$$\text{{$w\mid$ the nu...
admin
617
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
+
–
0
0 votes
1
1 answer
1.9k
1.9k views
Michael Sipser Edition 3 Exercise 2 Question 27 (Page No. 157)
$G$ is a natural-looking grammar for a fragment of a programming language, but $G$ is ambiguous$.$Show that $G$ is ambiguous$.$Give a new unambiguous grammar for the same...
admin
1.9k
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
ambiguous-grammar
+
–
1
1 vote
1
1 answer
841
841 views
Michael Sipser Edition 3 Exercise 2 Question 26 (Page No. 157)
Show that if $G$ is a $CFG$ in Chomsky normal form$,$ then for any string $w\in L(G)$ of length $n\geq 1,$ exactly $2n − 1$ steps are required for any derivation of $w.$
admin
841
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
conjunctive-normal-form
proof
+
–
0
0 votes
1
1 answer
700
700 views
Michael Sipser Edition 3 Exercise 2 Question 22 (Page No. 156)
Let $C = \{x\#y \mid x, y\in\{0,1\}^{*}$ and $x\neq y\}.$ Show that $C$ is a context-free language$.$
admin
700
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
+
–
0
0 votes
1
1 answer
591
591 views
Michael Sipser Edition 3 Exercise 2 Question 21 (Page No. 156)
Let $\Sigma = \{a,b\}.$ Give a $CFG$ generating the language of strings with twice as many $a’s$ as $b’s.$ Prove that your grammar is correct$.$
admin
591
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
context-free-language
+
–
0
0 votes
0
0 answers
544
544 views
Michael Sipser Edition 3 Exercise 2 Question 19 (Page No. 156)
Let $CFG$ $G$ be the following grammar$.$ $S\rightarrow aSb \mid bY \mid Y a$$Y\rightarrow bY \mid aY \mid \epsilon$Give a simple description of $L(G)$ in English$.$ Us...
admin
544
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
context-free-language
+
–
0
0 votes
0
0 answers
525
525 views
Michael Sipser Edition 3 Exercise 2 Question 15 (Page No. 156)
Give a counterexample to show that the following construction fails to prove that the class of context-free languages is closed under star. Let $A$ be a $\text{CFL}$ that...
admin
525
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-language
context-free-grammar
+
–
0
0 votes
1
1 answer
2.6k
2.6k views
Michael Sipser Edition 3 Exercise 2 Question 14 (Page No. 156)
Convert the following $\text{CFG}$ into an equivalent $\text{CFG}$ in Chomsky normal form,using the procedure given in $\text{Theorem 2.9.}$$A\rightarrow BAB \mid B \mid ...
admin
2.6k
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
conjunctive-normal-form
+
–
0
0 votes
1
1 answer
759
759 views
Michael Sipser Edition 3 Exercise 2 Question 13 (Page No. 156)
Let $G = (V, \Sigma, R, S)$ be the following grammar. $V = \{S, T, U\}; \Sigma = \{0, \#\};$ and $R$ is the set of rules$:$$S\rightarrow TT\mid U$$T\rightarrow 0T\mid T0\...
admin
759
views
asked
May 4, 2019
Theory of Computation
michael-sipser
theory-of-computation
context-free-grammar
regular-language
+
–
Page:
« prev
1
2
3
4
5
6
7
8
9
10
11
...
15
next »