code: function genLex (lex) {
      var s = [];
  
      if (lex.macros) {
          for (var macro in lex.macros) if (lex.macros.hasOwnProperty(macro)) {
              s.push(macro, '         ', lex.macros[macro], '\n');
          }
      }
      if (lex.actionInclude) {
          s.push('\n%{\n', lex.actionInclude, '\n%}\n');
      }
      s.push('\n%%\n');
      if (lex.rules) {
          for (var rule;rule=lex.rules.shift();) {
              s.push(genLexRegex(rule[0]), '         ', genLexRule(rule[1]), '\n');
          }
      }
      s.push('\n');
  
      return s.join('');
  }
docs: Generate lex format from lex JSON