I am studying finite tests of automata and grammars, and I am stuck on this question:
Construct a grammar that generates L: L = {a^n b^m c^m+n|n>=0, m>=0}
I believe that my productions should go like this:
S->aA | aB B->bB | bC C->cC | c Here where I have doubts
How do my products for C remember the numbers m and n? I guess this is more of a non-contextual grammar, if so, how should it be?
It looks like it should be like:
A->aAc | aBc | ac | epsilon B->bBc | bc | epsilon
You need to get C'c to count during the construction process. To show this without context, I would consider using the "Pump Tray."
Yes, that sounds like homework, but a hint:
, "a", "c". "b".
S -> X X -> aXc | Y Y -> bYc | e
where e == epsilonand Xare not required but for clarity added
e == epsilon
X
S-> Asc | A-> BAC | λ
This means that when you get at least 1 c or get a and b, you must have 2 c. i hope this was helpful
Well guys, here's how I do it:
P={S::=X|epsilon, X::=aXc|M|epsilon, M::=bMc|epsilon}
Source: https://habr.com/ru/post/1710916/More articles:Linq to XML Noob question - excellent and sorted by attributes - linqQuestion about the wireframe of objects - ormpossible errors in 'including * .c files' style C programming - cParallel Algorithms and Data Structures - algorithmEffectively insert and search strings - c #How to use classes? - classmsginit command line argument email addresses? - linuxWhat is the use of chords? - c #ALT-TAB Pixelated Application Icon - winformsПлагин проверки JQuery и требуемое поле переключения - javascriptAll Articles