You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Notes.md
+6-14Lines changed: 6 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,8 +43,7 @@ over bit vectors to discover backslash sequences and quote pairs; we introduce b
43
43
these properties.
44
44
45
45
We also make use of our ability to quickly detect whitespace in this early stage. We can use another bit-vector based
46
-
transformation to discover locations in our data that follow a structural character or quote followed by zero or more
47
-
characters of whitespace; excluding locations within strings, and the structural characters we have already discovered,
46
+
transformation to discover locations in our data that follow a structural character or quote or whitespace and are not whitesapce. Excluding locations within strings, and the structural characters we have already discovered,
48
47
these locations are the only place that we can expect to see the starts of the JSON 'atoms'. These locations are thus
49
48
treated as 'structural' ('pseudo-structural characters').
50
49
@@ -77,17 +76,10 @@ for each bitmap.
77
76
78
77
### Stage 3: Operation over indices
79
78
80
-
The indices form a relatively concise map of structurally important parts of our JSON input. However, since JSON is
81
-
recursively defined, we may nest structures (JSON "objects" and "arrays") inside other JSON structures. It is important
82
-
to be able to quickly traverse portions of our JSON structure at any given level - it is trivial for us to move around
83
-
in a way that follows the input text, but skipping to the next item at a given level may involve searching hundreds of
84
-
bytes of text).
79
+
This now works over a dual structure.
85
80
86
-
We can construct a simple data structure that allows us to thread together such structures relatively simply; at this
87
-
stage this code is not branch-free. We use an implicit 'stack' structure by virtue of threading together 'up-level
88
-
pointers' within the structure as we build it (these are pointers that, for each item in the structure we have seen
89
-
already, tell us which item in the structure that contains this one); to pop up a level, we simply follow one layer
90
-
of 'up-level pointers'.
81
+
1. The "state machine", whose role it is to validate the sequence of structural characters and ensure that the input is at least generally structured like valid JSON (after this stage, the only errors permissible should be malformed atoms and numbers). If and only if the "state machine" reached all accept states, then,
91
82
92
-
An equivalent operation requiring an external data structure would be to maintain a stack that essentially describes
93
-
all current levels of our structure as we traverse it; this may have performance advantages.
83
+
2. The "tape machine" will have produced valid output. The tape machine works blindly over characters writing records to tapes. These records create a lean but somewhat traversable linked structure that, for valid inputs, should represent what we need to know about the JSON input.
84
+
85
+
FIXME: a lot more detail is required on the operation of both these machines.
0 commit comments