4 kyu

JSON Parser

121 of 204joebandenburg
Description
Loading description...
JSON
Parsing
Algorithms
  • Please sign in or sign up to leave a comment.
  • seniorCrutchDeveloper Avatar

    I'm trying to post my solution and I keep getting an error from anti-chit - You cannot do that. What exactly can't I do, what do I need to fix? I'm tired of playing the guessing game. These rules should be clearly spelled out. I realize it probably doesn't like some of the naming in my code, but I shouldn't have to guess, the error should clearly tell me what needs to be changed. JSON.parse and eval I understandably don't use.

  • Expurple Avatar

    At least in Haskell, "valid ones" section of random tests generates numbers with exponent and expects the user to parse them, which contradicts the description. Example (note -3.458508438120589e-2 near the very end):

    ["[4",[{"p3sf":[{";bw(":null,"x6)zv":"z},"},[":[gw}",null],null,{"o4":"[pz","p25'":null}],"s}2":"y63","gs;":{"8t.ui":null,";4p":"kq(0","c":{"7":false,"j99":["a",false,null,[[true,"l",[36.58830218136235,{"mcw-":"0"}],"5",null],{"w.b":true},null,{"u":63.98380597025043," n":true,"][g'.":[[{"{j8g":[{"30oc":-25.68867089613157,"]9p":-78.98615392191253,";ir6q":[],"4]; ":false}],"::":null}],null],"y( ":-75.11152108324292,"(":{"h,9eb":null}}]]},"9p'":"g"}},[[true,[{"r7:":null}]],null,{";w0eo":"(7k","2(3b":80.80835504387433,"6":{"]":null,"273 ":null,"my)":{"m6bqn":null,"}7":"8",";y":{"a3":false,"g9":"1b"},"ie3]n":true}}},{},"1nyf-"],[-3.458508438120589e-2]],null]
    
  • Blind4Basics Avatar

    js at least: missing a fixed test with a string beginning with a whitespace. Fortunately, it appears frequently in the random tests, but having it in the fixed tests would be more comfortable. Increasing a bit the number of random tests would be a good idea too, to be sure tha nobody can slip through the tests.

  • FArekkusu Avatar

    The Haskell code block should not be visible in the JS version of the description.

  • puffnfresh Avatar

    Should tests ignore the order of pairs parsed in Object?

  • nomennescio Avatar

    And neither the grammar nor the description mentions whitespace should be ignored.

  • nomennescio Avatar

    Otherwise stated: the "grammar" does not differentiate clearly between terminal and non-terminal symbols.

  • nomennescio Avatar

    Haskell description does not give literal value to parse for Null.

  • nomennescio Avatar

    Haskell test is parsing Bool wrong; description mentions literals "True" and "False", whereas test code uses "true".

  • JohanWiltink Avatar
  • docgunthrop Avatar

    @joebandenburg, this is a great kata but it needs random tests. Marking this as an issue because a kata at this kyu ranking (approx. 3kyu) needs to have random tests.

    EDIT: BTW, I added some anti-cheats to prevent loopholes like the one reported by @Freywar.

  • Freywar Avatar

    This comment has been hidden.

  • joebandenburg Avatar

    I think this one would be relatively easy to translate into other langauges. The only JavaScript-specific elements are tests and the disabling of standard library JSON parsers. Translations welcome! :)