code: function JsonParserES5() {
      // invoke super constructor
      Parser.call(this, allTokens)
  
      // not mandatory, using <$> (or any other sign) to reduce verbosity (this. this. this. this. .......)
      var $ = this
  
      this.RULE("json", function() {
          // prettier-ignore
          $.OR([
              {ALT: function() {$.SUBRULE($.object)}},
              {ALT: function() {$.SUBRULE($.array)}}
          ])
      })
  
      this.RULE("object", function() {
          $.CONSUME(LCurly)
          $.MANY_SEP({
              SEP: Comma,
              DEF: function() {
                  $.SUBRULE2($.objectItem)
              }
          })
          $.CONSUME(RCurly)
      })
  
      this.RULE("objectItem", function() {
          $.CONSUME(StringLiteral)
          $.CONSUME(Colon)
          $.SUBRULE($.value)
      })
  
      this.RULE("array", function() {
          $.CONSUME(LSquare)
          $.MANY_SEP({
              SEP: Comma,
              DEF: function() {
                  $.SUBRULE2($.value)
              }
          })
          $.CONSUME(RSquare)
      })
  
      this.RULE("value", function() {
          // prettier-ignore
          $.OR([
              {ALT: function() {$.CONSUME(StringLiteral)}},
              {ALT: function() {$.CONSUME(NumberLiteral)}},
              {ALT: function() {$.SUBRULE($.object)}},
              {ALT: function() {$.SUBRULE($.array)}},
              {ALT: function() {$.CONSUME(True)}},
              {ALT: function() {$.CONSUME(False)}},
              {ALT: function() {$.CONSUME(Null)}}
          ])
      })
  
      // very important to call this after all the rules have been defined.
      // otherwise the parser may not work correctly as it will lack information
      // derived during the self analysis phase.
      this.performSelfAnalysis()
  }
docs: ----------------- parser -----------------