Exercise 23:

Expressions over binary + and dereferences with ^
The set of tokens of the language is {+,^,IDENT}. The token IDENT represents an identifier that can be dereferenced. Such tokens are non-empty sequences of alphanumeric characters and underscore, not starting by a digit. Examples of correct expressions are “x + y^”, “p^^^”, and examples of incorrect expressions are “^i”, “x +^ y”, etc. The generated AST must correspond to an interpretation of the operator + as left-associative. Deferences must be represented by a subtree with the symbol “^” as root and the identifier being dereferenced as only child. Note that the implicit parenthesization of “p^^” is “(p^)^”. For instance, the following input
p^^^ + x
produces the following AST
+(^(^(^(p))),x)
Authors: Nil Mamano / Documentation:
To be able to submit you need to either log in, register, or become a guest.