Consider the following grammar for integer binary trees (in linearized form): btree → ( number btree btree ) | nil Write an attribute grammar to check that a binary tree is ordered, that is, that the values of the numbers of the first subtree are ≤ the value of the current number and the values of all the numbers of the second subtree are > the value of the current number. For example, (2 (1 nil nil) (3 nil nil)) is ordered, but (1 (2 nil nil) (3 nil nil)) is not.



Answer :

Other Questions