Exercício 09.29

Apresente uma derivação para a sentença abbcabbc sobre a gramática a seguir.

G = ({S, A, B, C, T}, {a, b, c}, P, S)
P = {< S >        ->  a < A > < S >  |  b < B > < S >  |  c < C > < S >  |  < T > 
     < A > a      ->  a < A >
     < B > a      ->  a < B >
     < C > a      ->  a < C >
     < A > b      ->  b < A >
     < B > b      ->  b < B >
     < C > b      ->  b < C >
     < A > c      ->  c < A >
     < B > c      ->  c < B >
     < C > c      ->  c < C >
     < A > < T >  ->  < T > a
     < B > < T >  ->  < T > b
     < C > < T >  ->  < T > c
     < T >        ->  ε }

Resposta

< S >
a < A > < S >
a < A > b < B > < S >
a < A > b < B > b < B > < S >
a < A > b < B > b < B > c < C > < S >
a < A > b < B > b < B > c < C > < T >
a < A > b < B > b < B > c < T > c
a < A > b < B > b c < B > < T > c
a < A > b < B > b c < T > b c
a < A > b b < B > c < T > b c
a < A > b b c < B > < T > b c
a < A > b b c < T > b b c
a b < A > b c < T > b b c
a b b < A > c < T > b b c
a b b c < A > < T > b b c
a b b c < T > a b b c
a b b c a b b c

Recomendamos

Revista Digital cert.br Copy