TITLE "mp1.a mp1 solution, by Douglas Jones" ; exports ROOT, the address of the root of a binary tree representing ; (Construct((a((binary)tree))that(represents(the((following)string))))) USE "hawk.macs" ; we need the ALIGN directive INT ROOT ; tell the linker where the tree is NULL = 0 ; Each node is commented with the string it represents. ; Notes are labeled with the parts of speech from English grammar, ; with prefixes based on context, since the binary tree comes close ; to being a grammatical parse of the sentence. ; (Construct((a((binary)tree))that(represents(the((following)string))))) ALIGN 4 ROOT: W NULL ; left pointer W OBJECT ; right pointer ASCII "construct",0 ; data ; ((a((binary)tree))that(represents(the((following)string)))) ALIGN 4 OBJECT: W DIRECTOBJECT ; left pointer W MODIFIER ; right pointer ASCII "that" ; (a((binary)tree)) ALIGN 4 DIRECTOBJECT: W NULL ; left pointer W OBJNOUNPHRASE ; rignt pointer ASCII "a" ; ((binary)tree) ALIGN 4 OBJNOUNPHRASE: W OBJADJECTIVE ; left pointer W NULL ; rignt pointer ASCII "tree" ; (binary) ALIGN 4 OBJADJECTIVE: W NULL ; left pointer W NULL ; rignt pointer ASCII "binary" ; (represents(the((following)string))) ALIGN 4 MODIFIER: W NULL ; left pointer W MODNOUNPHRASE ; right pointer ASCII "represents" ; (the((following)string)) ALIGN 4 MODNOUNPHRASE: W NULL ; left pointer W MODNOUN ; right pointer ASCII "the" ; ((following)string) ALIGN 4 MODNOUN: W MODADJECTIVE ; left pointer W NULL ; right pointer ASCII "string" ; (following) ALIGN 4 MODADJECTIVE: W NULL ; left pointer W NULL ; right pointer ASCII "following" END