Reputation:
Give the EBNF specification for the language L
that is made up of the chars a
, b
and c
such that sentences in the language have the form
L : sqsR
-s is a string of any combination of the characters a and b
-sR is that same string s reversed
-q is an odd number of c's followed by either an odd number of b's
or an even number of a’s.
What I have so far:
L -> S
S -> {a}{b}Q
Q ->
If this is right, I'm still not really sure how to produce from Q
and also how to represent S
in reverse.
Upvotes: 1
Views: 972
Reputation: 135285
This is a string that starts and ends with the same string, but reversed:
X -> aXa
-> bXb
This is a string with an odd number of c's:
Y -> cY2
Y2 -> ccY2
I've left out some crucial bits, but hopefully this can get you started.
Upvotes: 2
Reputation: 101181
Upvotes: 1