Skip to content

Instantly share code, notes, and snippets.

@Tasiro
Tasiro / Json.dnh
Last active October 7, 2019 16:40
A proof of concept json parser.
// Json format:
// type jsonStrings = string[]
// type jsonArrays = value[]
// type jsonObjects = [keyStringIndex, ...value][]
// type value = [-1, 0] (for parsing error) | [0, 0] (for null) | [1, 0 or 1] (for true (1) and false (0)) | [jsonValueType, indexInCorrespondingArray]
// type jsonValueType = -1 (for parsing error) | 0 (for null) | 1 (for boolean) | 2 (for number) | 3 (for string) | 4 (for array) | 5 (for object)
let JsonTypeNull = 0;
let JsonTypeBoolean = 1;