Exercício 07.28

Apresente uma derivação à extrema esquerda (DEE) da sentença x + (y * (z * x) + z) sobre a gramática a seguir.

G = ({S, A, B, C}, {x, y, z, +, *, (, )}, P, S)
P = {< S >  ->  < S > + < S >  |  < A >
     < A >  ->  < A > * < A >  |  < B >
     < B >  ->  ( < S > )  |  < C >
     < C >  ->  x  |  y  |  z }

Resposta

< S >
< S > + < S >
< A > + < S >
< B > + < S >
< C > + < S >
x + < S >
x + < A >
x + < B >
x + ( < S > ) 
x + ( < S > + < S > ) 
x + ( < A > + < S > ) 
x + ( < A > * < A > + < S > ) 
x + ( < B > * < A > + < S > ) 
x + ( < C > * < A > + < S > ) 
x + ( y * < A > + < S > ) 
x + ( y * < B > + < S > ) 
x + ( y * ( < S > ) + < S > ) 
x + ( y * ( < A > ) + < S > ) 
x + ( y * ( < A > * < A > ) + < S > ) 
x + ( y * ( < B > * < A > ) + < S > ) 
x + ( y * ( < C > * < A > ) + < S > ) 
x + ( y * ( z * < A > ) + < S > ) 
x + ( y * ( z * < B > ) + < S > ) 
x + ( y * ( z * < C > ) + < S > ) 
x + ( y * ( z * x ) + < S > ) 
x + ( y * ( z * x ) + < A > ) 
x + ( y * ( z * x ) + < B > ) 
x + ( y * ( z * x ) + < C > ) 
x + ( y * ( z * x ) + z )

Recomendamos

Clique Alimentos Copy Revista Digital