Exercício 07.77

Apresente uma derivação à extrema direita (DED) da sentença x = a + a * (b - c) + (b - c) * d sobre a gramática a seguir.

G = ({A, E, T, F, V}, {a, b, c, d, x, =, +, -, *, /, (, )}, P, A)
P = {< A >  ->  < V > = < E >
     < E >  ->  < E > + < T >  |  < E > - < T >  |  < T >
     < T >  ->  < T > * < F >  |  < T > / < F >  |  < F >
     < F >  ->  ( < E > )  |  < V >
     < V >  ->  a  |  b  |  c  |  d  |  x }

Resposta

< A >
< V > = < E >
< V > = < E > + < T >
< V > = < E > + < T > * < F >
< V > = < E > + < T > * < V >
< V > = < E > + < T > * d
< V > = < E > + < F > * d
< V > = < E > + ( < E > ) * d
< V > = < E > + ( < E > - < T > ) * d
< V > = < E > + ( < E > - < F > ) * d
< V > = < E > + ( < E > - < V > ) * d
< V > = < E > + ( < E > - c ) * d
< V > = < E > + ( < T > - c ) * d
< V > = < E > + ( < F > - c ) * d
< V > = < E > + ( < V > - c ) * d
< V > = < E > + ( b - c ) * d
< V > = < E > + < T > + ( b - c ) * d
< V > = < E > + < T > * < F > + ( b - c ) * d
< V > = < E > + < T > * ( < E > ) + ( b - c ) * d
< V > = < E > + < T > * ( < E > - < T > ) + ( b - c ) * d
< V > = < E > + < T > * ( < E > - < F > ) + ( b - c ) * d
< V > = < E > + < T > * ( < E > - < V > ) + ( b - c ) * d
< V > = < E > + < T > * ( < E > - c ) + ( b - c ) * d
< V > = < E > + < T > * ( < T > - c ) + ( b - c ) * d
< V > = < E > + < T > * ( < F > - c ) + ( b - c ) * d
< V > = < E > + < T > * ( < V > - c ) + ( b - c ) * d
< V > = < E > + < T > * ( b - c ) + ( b - c ) * d
< V > = < E > + < F > * ( b - c ) + ( b - c ) * d
< V > = < E > + < V > * ( b - c ) + ( b - c ) * d
< V > = < E > + a * ( b - c ) + ( b - c ) * d
< V > = < T > + a * ( b - c ) + ( b - c ) * d
< V > = < F > + a * ( b - c ) + ( b - c ) * d
< V > = < V > + a * ( b - c ) + ( b - c ) * d
< V > = a + a * ( b - c ) + ( b - c ) * d
x = a + a * ( b - c ) + ( b - c ) * d

Recomendamos

Vida de Suporte Revista Digital Java Magazine