The parser creates circular lists for some node types and then breaks them. It would be simpler to just keep head and tail pointers in the parser for the appropriate productions.
Created attachment 16934 [details] patch
Comment on attachment 16934 [details] patch r=me