Could someone help me with the following language:
{a^n b^m | n<= m <= 2n}
Sorry for ignorance, but I can not form a stack automaton with this language. I'm trying through a deterministic stack automaton but nothing comes out.
Could someone help me with the following language:
{a^n b^m | n<= m <= 2n}
Sorry for ignorance, but I can not form a stack automaton with this language. I'm trying through a deterministic stack automaton but nothing comes out.
{a^n b^m | n<= m <= 2n}
means:
Expression is accepted with N elements and A and M elements of B, where M is between N and 2N.
In practice, the automaton accepts:
AB
ABB
AABB
AABBB
AABBBB
...
That is, the amount of B
must be equal to the amount of A
, or greater than the amount of A
, as long as it is not greater than double A
.
EDIT
I found this site cool to help you.
The following grammar is enough to recognize this language:
Thisgrammargenerateswordsincrementally,alwaysincreasinga
andoneortwob
sinauto-nestedmode.
Thisgrammarisa context-free grammar generated from this meta-language: link
The stack automaton is this:
I've created a self-addressed question to deal fairly with transforming context-free grammars into stack automata. I have even used the grammar of this question as an example