How do I build a list of nodes with no root?

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!

0 Comments  (click to add your comment)
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

About | Sitemap | Contact