Helper `gen` function calls node type handler.
function gen(node) {
  if (node && !generator[node.type]) {
    throw new Error(`${node.type} is not supported in NFA/DFA interpreter.`);
  }

  return node ? generator[node.type](node) : '';
}