How do I build a list of nodes with no root?
Created May 4, 2012
Monty Zukowski
I want to translate a subtree like #(CHAIN ID) into three nodes like #(#[ASSIGNMENT], ID, ID) followed by #[NEWLINE, " : "] then #[EXIT_SUB]. I haven't found any examples of how to do this using # notation. Any hints on how to do this manually?
The first argument to a tree contstructor can be null to create a sibling list. Tree constructors can be nested. E.g. your problem can be solved as:
#chain = #(null, #(<the assignment subtree>), #[NEWLINE, " : "], #[EXIT_SUB, "EXIT_SUB"] )
Thanks to Johan Rosman for this one!