



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




False. Context-sensitive syntax is the same as static semantics, which means the correctness of the syntax with respect to context, such as the symbol table, e.g. type compatibility of left and right sides of an assignment statement.
class-specifier ::= class identifier [ : identifier ] { member-declaration {member-declaration} } member-declaration ::= identifier identifier function-definition | int identifier function-definition
Note that this syntax contains terminal symbols { and } which are different from the extended BNF meta-symbols { and }, and distinguished by underlining. Write an equivalent syntax graph and a recursive descent parser for this construction. Assume the existence of production rules for function-definition and corresponding parsing procedure FUNCTION DEFINITION, and a scanning procedure GET TOKEN to set a global string variable TOKEN to the token type of the next token. Furthermore, assume that TOKEN is already set to the first token when parsing begins.
The syntax graph is:
(a) Indicate which attributes are inherited, which are synthesized, and which are intrinsic.
inherited - count of <b-n> and <c-n> synthesized - count of <a-n> intrinsic - none
(b) Draw the attributed parse tree for the string โaaabbbcccโ, showing clearly the order of evaluation of all attributes.
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
/ |
<a-n> <b-n> <c-n>