Fill This Form To Receive Instant Help

Help in Homework
trustpilot ratings
google ratings


Homework answers / question archive / Consider the following grammar, which supports the syntax needed to return a value from a subroutine call

Consider the following grammar, which supports the syntax needed to return a value from a subroutine call

Computer Science

Consider the following grammar, which supports the syntax needed to return a value from a subroutine call.

StmtAssignment | FunCall | return id FunDefAssignmentid := ExprFunCallName ( ArgList )FunDefType Name  ( ParamList )ExprPrimary ExprTailExprTail op expr | εPrimary id | SubrCall | ( Expr ) Op + | - | * | / ArgList Expr ArgsTail |   εArgsTail , ArgList ε ParamListType id ParamTail  εParamTail, ParamList   εNameidType→int | float | void

Briefly sketch out the salient design of an Attribute Grammar, which extends the above Context-Free grammar, that would be required to handle the static semantics associated with making a function call.

x = foo(a, b)

You should demonstrate you understand attributes, inherited attributes, and synthesized attributes.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Answer Preview

Answer:

A Synthesized attribute is an attribute of the non-terminal on the left-hand side of a production. Synthesized attributes represent information that is being passed up the parse tree. The attribute can take value only from its children (Variables in the RHS of the production)

An attribute is said to be Inherited attribute if its parse tree node value is determined by the attribute value at parent and/or siblings node

Inherited attribute is used by only L attributed SDT.

Related Questions