automata theory - How to construct a grammar that generates language L? -
i'm in formal languages class , have grammar quiz coming up. i'm assuming appear.
consider alphabet ∑ = {a, b, c}. construct grammar generates language l = {bab^nabc^na^p : n ≥ 0, p ≥ 1}. assume start variable s.
it long time since worked formal languages last time, so, please, forgive rustyness, language: divide s
prefix variable (a
) , suffix variable (b
). then, handle prefix , suffix separately, both of them have possible rule of further recursion, , end sign of empty, no occurrence required , constant @ least occurrence required.
{bab^nabc^na^p : n ≥ 0, p ≥ 1} s -> asb -> babaabc -> {empty} b -> ba b ->
Comments
Post a Comment