Exercício 07.64

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

G = ({A, B, C, D, E}, {x, y, z, k, w, =, +, -, *, /, (, )}, P, A)
P = {< A >  ->  < E > = < B >
     < B >  ->  < C > + < B >  |  < C > - < B >  |  < C >
     < C >  ->  < D > * < C >  |  < D > / < C >  |  < D >
     < D >  ->  ( < B > )  |  < E >
     < E >  ->  x  |  y  |  z  |  k  |  w }

Resposta

< A >
< E > = < B >
< E > = < C >
< E > = < D > * < C >
< E > = < D > * < D >
< E > = < D > * ( < B > )
< E > = < D > * ( < C > - < B > )
< E > = < D > * ( < C > - < C > )
< E > = < D > * ( < C > - < D > )
< E > = < D > * ( < C > - < E > )
< E > = < D > * ( < C > - z )
< E > = < D > * ( < D > - z )
< E > = < D > * ( < E > - z )
< E > = < D > * ( w - z )
< E > = ( < B > ) * ( w - z )
< E > = ( < C > + < B > ) * ( w - z )
< E > = ( < C > + < C > ) * ( w - z )
< E > = ( < C > + < D > ) * ( w - z )
< E > = ( < C > + < E > ) * ( w - z )
< E > = ( < C > + k ) * ( w - z )
< E > = ( < D > + k ) * ( w - z )
< E > = ( < E > + k ) * ( w - z )
< E > = ( z + k ) * ( w - z )
x = ( z + k ) * ( w - z )

Recomendamos

Agenda TI Kinghost Clickarvore