1. The grammar G: SSS alb is ambiguous. That means at least some of the strings in its language have more than one leftmost derivation. However, it may be that some strings in the language have only one derivation. Identify from the list below a string that has exactly TWO leftmost derivations in G. a) abbab b) aa c) bb d) aab 2. Programming languages are often described using an extended form of context-free grammar, where square brackets are used to denote an optional construct. For example, A → B[C]D says that an A can be replaced by a B and a D, with an optional C between them. This notation does not allow us to describe anything but context-free languages, since an extended production can always be replaced by several conventional productions. Suppose a grammar has the extended productions: A → B[CD] EF | BC [DE] F Convert this pair of extended productions to conventional productions. Identify, from the list below, the conventional productions that are equivalent to the extended productions above. a) A - → BCDEF BEF | BCF BA1F CD | DE | E b) A A1 →> c) A BCDEF | BEF d) A →> BA1F A1 CD | DE 3. Consider the grammars: G₁: S → SaS | aa | a G2: S→ SS & G3: S→ SS a G4: S→ SS | aa G5: S→ Sala G6: SaSalaa|a G7: S→ SAS | ε Describe the language of each of these grammars. Then, identify from the list below a pair of grammars that define the same language. a) G5, G4 b) G6, G2 c) G1, G2 d) G1, G3 b) A → BA1F A1 → CD | DE | ɛ BCDEF ❘ BEF c) A -> d) A A1 -> CD | DE → BA1F 3. Consider the grammars: G₁: S SaS aaa G2: S→ SS & G3: S→ SS a G4: S SS aa G5: S→ Sala G6: SaSa aala G7: S SAS | E →> Describe the language of each of these grammars. Then, identify from the list below a pair of grammars that define the same language. a) G5, G4 b) G6, G2 c) G1, G2 d) G1, G3 4. Here is a context-free grammar G: S →> AB A → 0A1 | 2 B1B3A Which of the following strings is in L(G)? a) 00213021 b) 0021113002111 c) 21113021 d) 021131021 5. Consider the languge L={a}. Which grammar defines L? a) G₁:SACIC, A → b b) G₁:S ACla, A → b →> c) G₁:Sacla, A → clblɛ d) G₁:S →dla, A → clblɛ Submit Homework

Elements Of Modern Algebra
8th Edition
ISBN:9781285463230
Author:Gilbert, Linda, Jimmie
Publisher:Gilbert, Linda, Jimmie
Chapter1: Fundamentals
Section1.4: Binary Operations
Problem 14E: Assume that is a binary operation on a non empty set A, and suppose that is both commutative and...
icon
Related questions
Question
1. The grammar G:
SSS alb
is ambiguous. That means at least some of the strings in its language have
more than one leftmost derivation. However, it may be that some strings in
the language have only one derivation. Identify from the list below a string
that has exactly TWO leftmost derivations in G.
a) abbab
b) aa
c) bb
d) aab
2. Programming languages are often described using an extended form of
context-free grammar, where square brackets are used to denote an
optional construct. For example, A → B[C]D says that an A can be
replaced by a B and a D, with an optional C between them. This notation
does not allow us to describe anything but context-free languages, since an
extended production can always be replaced by several conventional
productions.
Suppose a grammar has the extended productions:
A
→
B[CD] EF | BC [DE] F
Convert this pair of extended productions to conventional productions.
Identify, from the list below, the conventional productions that are
equivalent to the extended productions above.
a) A
-
→
BCDEF BEF | BCF
BA1F
CD | DE | E
b) A
A1 →>
c) A
BCDEF | BEF
d) A
→>
BA1F
A1
CD | DE
3. Consider the grammars:
G₁: S → SaS | aa | a
G2: S→ SS &
G3: S→ SS a
G4: S→ SS | aa
G5: S→ Sala
G6: SaSalaa|a
G7: S→ SAS | ε
Describe the language of each of these grammars. Then, identify from the
list below a pair of grammars that define the same language.
a) G5, G4
b) G6, G2
c) G1, G2
d) G1, G3
Transcribed Image Text:1. The grammar G: SSS alb is ambiguous. That means at least some of the strings in its language have more than one leftmost derivation. However, it may be that some strings in the language have only one derivation. Identify from the list below a string that has exactly TWO leftmost derivations in G. a) abbab b) aa c) bb d) aab 2. Programming languages are often described using an extended form of context-free grammar, where square brackets are used to denote an optional construct. For example, A → B[C]D says that an A can be replaced by a B and a D, with an optional C between them. This notation does not allow us to describe anything but context-free languages, since an extended production can always be replaced by several conventional productions. Suppose a grammar has the extended productions: A → B[CD] EF | BC [DE] F Convert this pair of extended productions to conventional productions. Identify, from the list below, the conventional productions that are equivalent to the extended productions above. a) A - → BCDEF BEF | BCF BA1F CD | DE | E b) A A1 →> c) A BCDEF | BEF d) A →> BA1F A1 CD | DE 3. Consider the grammars: G₁: S → SaS | aa | a G2: S→ SS & G3: S→ SS a G4: S→ SS | aa G5: S→ Sala G6: SaSalaa|a G7: S→ SAS | ε Describe the language of each of these grammars. Then, identify from the list below a pair of grammars that define the same language. a) G5, G4 b) G6, G2 c) G1, G2 d) G1, G3
b) A → BA1F
A1 → CD | DE | ɛ
BCDEF ❘ BEF
c) A
->
d) A
A1 ->
CD | DE
→
BA1F
3. Consider the grammars:
G₁: S SaS aaa
G2: S→ SS &
G3: S→ SS a
G4: S SS aa
G5: S→ Sala
G6: SaSa aala
G7: S SAS | E
→>
Describe the language of each of these grammars. Then, identify from the
list below a pair of grammars that define the same language.
a) G5, G4
b) G6, G2
c) G1, G2
d) G1, G3
4. Here is a context-free grammar G:
S →> AB
A → 0A1 | 2
B1B3A
Which of the following strings is in L(G)?
a) 00213021
b) 0021113002111
c) 21113021
d) 021131021
5. Consider the languge L={a}. Which grammar defines L?
a) G₁:SACIC, A → b
b) G₁:S ACla, A → b
→>
c) G₁:Sacla, A → clblɛ
d) G₁:S →dla, A → clblɛ
Submit Homework
Transcribed Image Text:b) A → BA1F A1 → CD | DE | ɛ BCDEF ❘ BEF c) A -> d) A A1 -> CD | DE → BA1F 3. Consider the grammars: G₁: S SaS aaa G2: S→ SS & G3: S→ SS a G4: S SS aa G5: S→ Sala G6: SaSa aala G7: S SAS | E →> Describe the language of each of these grammars. Then, identify from the list below a pair of grammars that define the same language. a) G5, G4 b) G6, G2 c) G1, G2 d) G1, G3 4. Here is a context-free grammar G: S →> AB A → 0A1 | 2 B1B3A Which of the following strings is in L(G)? a) 00213021 b) 0021113002111 c) 21113021 d) 021131021 5. Consider the languge L={a}. Which grammar defines L? a) G₁:SACIC, A → b b) G₁:S ACla, A → b →> c) G₁:Sacla, A → clblɛ d) G₁:S →dla, A → clblɛ Submit Homework
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Similar questions
Recommended textbooks for you
Elements Of Modern Algebra
Elements Of Modern Algebra
Algebra
ISBN:
9781285463230
Author:
Gilbert, Linda, Jimmie
Publisher:
Cengage Learning,
Algebra: Structure And Method, Book 1
Algebra: Structure And Method, Book 1
Algebra
ISBN:
9780395977224
Author:
Richard G. Brown, Mary P. Dolciani, Robert H. Sorgenfrey, William L. Cole
Publisher:
McDougal Littell