I
I
ily942016-10-15 15:39:29
IT education
ily94, 2016-10-15 15:39:29

How to build such a grammar?

It is required to construct a grammar generating the language
L = {2*2-1,2*2*2-1-1,2*2*2*2-1-1-1,....}, here there are one more twos than units, and there is at least one "-" sign, is it possible to convert this grammar to type 3?
My version was like this:
G = ( {S,A,B} , {2,*,1,-}, P, S } )
S -> A2B
A -> A2* | E
B -> -1B | E
I know that the option is wrong, because the minus may not appear + as I was told, we can apply rule B more times (compared to A, then there will be more units)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2016-10-15
@ily94

S -> 2*2A-1
A -> *2A-1 | E

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question