Implement a full-featured JSON parser capable of processing deeply nested structures, complex character escaping, and varied whitespace configuration.
Building a robust parser requires implementing a recursive descent state machine that can tokenize input strings accurately. This challenge tests your ability to handle non-trivial edge cases such as escaped quotes, multi-line strings, and deep structural hierarchies that push the limits of recursive execution.
Recursive Descent Engine: Develop a parsing system that uses multiple recursive functions to consume structural tokens and build the corresponding JavaScript tree.
Universal Type Support: Correctlly parse number (including integers, floats, and negative values), string, boolean, and null from valid JSON formatting.
Compound Handling: Recursively assemble complex arrays and objects with arbitrary levels of depth.
Specification Compliance
Advanced Escaping: Support the full range of JSON escape sequences, specifically transforming \\\" to " and \\\\ to \ inside string literals.
Whitespace Tolerance: Correctlly ignore and skip whitespace characters (, \n, \r, \t) found between tokens and property definitions.
Structural Integrity: Ensure object keys are always parsed as strings and that property-value pairs are separated by colons.
Manual Implementation: You are strictly forbidden from using eval(), new Function(), or the native JSON.parse() method.