move generator function into parser and render