HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

Bottom-Up Evaluation of Inherited Attributes

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
bottomattributesevaluationinherited

Problem

I came across $2$ translation schemes of Syntax Directed Translation (SDT) in compilers which are as follows :

  • Using a top-down translation scheme, we can implement any


$L$-attributed definition based on a $LL(1)$ grammar.

  • Using a bottom-up translation scheme, we can also implement any


$L$-attributed definition based on a $LL(1)$ grammar (each $LL(1)$ grammar
is also an $LR(1)$ grammar).

What these $2$ Definitions actually mean ? I am not getting ..

I am well aware of $L$-attributed definition and $S$-attributed definition of SDT and top down parsing and bottom up parsing but It is just that I am unable to recollect this information and phrase it according to the definitions given above.

It would be good, if I can get one example of both definitions so, that I can phrase it meaningfully of what is said .

Solution


  • Using a top-down translation scheme, we can implement any $LL$-attributed definition based on $LL(1)$ grammar.



  • Using a bottom-up translation scheme, we can also implement any $LL$-attributed definition based on $LL(1)$ grammar (each $LL(1)$ grammar is also an $LR(1)$ grammar). Using bottom-up translation scheme, we implement $LR$ grammar actually but since $LL(1) \subset LR(1)$ we can safely implement $LL(1)$ grammar as well.

Context

StackExchange Computer Science Q#67956, answer score: 3

Revisions (0)

No revisions yet.