Sunday hackathon. Parses to PHP. Crazy nesting. TODO: DRY