Fill This Form To Receive Instant Help
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.
Stmt→Assignment | FunCall | return id | FunDefAssignment→id := ExprFunCall→Name ( ArgList )FunDefType Name ( ParamList )Expr→Primary ExprTailExprTail →op expr | εPrimary →id | SubrCall | ( Expr ) Op →+ | - | * | / ArgList →Expr ArgsTail | εArgsTail →, ArgList | ε ParamList→Type id ParamTail | εParamTail→, ParamList | εName→idType→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.
Already member? Sign In