Question

In: Computer Science

#1 We are given the grammar rules A ➝ F B E B ➝ A C...

#1

We are given the grammar rules

A ➝ F B E

B ➝ A C

These rules are only some of the rules of a larger grammar G, but we are not given the remaining rules of G. We are told that A is the start symbol of G and that the following holds:

{ε, c, d} ⊆ FIRST(C)

{ε, e} ⊆ FIRST(E)

{ε, f, g} ⊆ FIRST(F)

Recall that end of file is denoted EOF. The symbol ⊆ is used to denote set inclusion. For example, {ε, c, d} ⊆ FIRST(C) means that ε, c, and d are all elements of FIRST(C). Which of the following must hold?

c ∈ FIRST(B)

EOF ∈ FIRST(B)

a ∈ FIRST(B)

ε ∈ FIRST(B)

f ∈ FIRST(B) -- Correct Answer

d ∈ FIRST(B)

Need explanation on how to get First(A) and First(B).

#2

We are given the grammar rules

A ➝ F E

B ➝ A C

           These rules are only some of the rules of a larger grammar G, but we are not given the remaining rules of G. We are told that A is the start symbol of G and that the following holds:

{ε, c, d} ⊆ FIRST(C)

{ε, e}      ⊆ FIRST(E)

{ε, f, g}   ⊆ FIRST(F)

Recall that end of file is denoted EOF. The symbol ⊆ is used to denote set inclusion. For example, {ε, c, d} ⊆ FIRST(C) means that ε, c, and d are all elements of FIRST(C). Which of the following must hold (more than one choice or no choice can be correct)?

ε ∈ FIRST(B) -- Correct Answer  

EOF ∈ FIRST(B)

f ∈ FIRST(B) --  Correct Answer  

d ∈ FIRST(B) --  Correct Answer  

c ∈ FIRST(B) --  Correct Answer  

I can get {f,g,e} for First(B). Need explanation why empty, d, and c are a part of First(B).

Solutions

Expert Solution


Related Solutions

Consider the cities B,C,D,E,F,G The costs of the possible roads between cities are given below: c(B,F)...
Consider the cities B,C,D,E,F,G The costs of the possible roads between cities are given below: c(B,F) = 11 c(B,G) = 10 c(C,G) = 8 c(D,E) = 12 c(D,F) = 13 c(E,F) = 9 c(E,G ) = 7 What is the minimum cost to build a road system that connects all the cities?
Given the operation times provided: JOB TIMES (minutes) A B C D E F Center 1...
Given the operation times provided: JOB TIMES (minutes) A B C D E F Center 1 20 16 43 60 35 42 Center 2 27 30 51 12 28 24 a. Develop a job sequence that minimizes idle time at the two work centers. The sequence is             (Click to select)  A-B-C-D-E-F  B-A-C-E-F-D  C-A-B-D-E-F  F-E-D-A-B-C  E-F-D-B-C-A  D-C-B-A-E-F  . b. Determine idle time of center 2, assuming no other activities are involved. Idle time             minutes
- Given this Grammar (we substitute one element per line) (rules#) One substitution must be permitted...
- Given this Grammar (we substitute one element per line) (rules#) One substitution must be permitted by one rule (rules#) <S> -> a<S>c<B> | <A> | b (1,2,3) <A> -> c<A> | c (4,5) <B> -> d | <A> (6,7) - Which of the following sentences are in the language generated by the Grammar ? sentences a- abcd b- acccbd c- acccbcc d- acd e- accc (accc sentence can be left_derived by using some grammar rules) : The e- Solution...
Give the grammar following: E --> E + T | T T --> T* F |...
Give the grammar following: E --> E + T | T T --> T* F | F F --> (E) | id Eliminating the left recursion rules and getting a non-left recursive equivalent grammar.
Consider the following grammar G: E -> E + T | T T -> T F...
Consider the following grammar G: E -> E + T | T T -> T F | F F -> F* | a | b This grammar can be used to generate regular expressions over the alphabet {a,b} with standard precedence rules. Show your solution for each of the following 5 points:     1. Remove left recursion and write the resulting grammar G1.     2. For the grammar G1, compute and write the sets FIRST for every right hand side...
12. Assume that we randomly choose from the letters {A, B, C, D, E, F, G,...
12. Assume that we randomly choose from the letters {A, B, C, D, E, F, G, H, I, J, K, L} (without replacing the letters), until they have all been taken. (a) Find the probability that the letters A and K are chosen successively in the given order. (b) Find the probability that the letters G, H, I, are chosen successively in the given order. c) Find the probability that the string "LAI" appears somewhere in the sequence of letters....
(a) (f ∘ g)(3) (b) g(f(2)) (c) g(f(5)) (d) (f ∘ g)(−3) (e) (g ∘ f)(−1) (f) f(g(−1))
(a)    (f ∘ g)(3) (b)    g(f(2)) (c)    g(f(5)) (d)    (f ∘ g)(−3) (e)    (g ∘ f)(−1) (f)    f(g(−1))  
Seven people (A,B,C,D,E, F, and G) are seated in a row. Suppose A,B, and C are...
Seven people (A,B,C,D,E, F, and G) are seated in a row. Suppose A,B, and C are freshmen, D and E are sophomores and F and G are juniors. How many arrangements are possible if: (a) D and F must sit together? (b) A and C must not sit together? (c) All freshmen must sit together? (d) All freshmen must sit together, all sophomores must sit together, and all juniors must sit together? (e) Exactly two people sit between A and...
If there are 7 total notes C, D, E, F, G, A, and B and if...
If there are 7 total notes C, D, E, F, G, A, and B and if a five-note melody is selected at random (so that all melodies counted in part (a) are equally likely to be chosen), what is the probability that the melody will include exactly two “A” notes, but no other repeated notes? (A few allowable examples: AACEG, ACAEG, DFACA, EAABC, etc.)
1. a. How many permutations are there of the letters {A,B,C,D,E,F}? Of there, how many are...
1. a. How many permutations are there of the letters {A,B,C,D,E,F}? Of there, how many are even? b. Express the permutation BAFEDC in P6 in cycle notation and determine whether it is even or odd. c. Determine the composition BAFEDC*BCAFDE in P6. Is the composition even or odd? d. What is the members of P6 whose cycle notation (1345)(26)?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT