-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
38683a3
commit 049d45b
Showing
4 changed files
with
90 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
pragma circom 2.1.9; | ||
|
||
template Syntax() { | ||
//-Delimeters---------------------------------------------------------------------------------// | ||
// - ASCII char: `{` | ||
signal output START_BRACE <== 123; | ||
// - ASCII char: `}` | ||
signal output END_BRACE <== 125; | ||
// - ASCII char `[` | ||
signal output START_BRACKET <== 91; | ||
// - ASCII char `]` | ||
signal output END_BRACKET <== 93; | ||
// - ASCII char `"` | ||
signal output QUOTE <== 34; | ||
// - ASCII char `:` | ||
signal output COLON <== 58; | ||
// - ASCII char `,` | ||
signal output COMMA <== 44; | ||
//-White_space--------------------------------------------------------------------------------// | ||
// - ASCII char: `\n` | ||
signal output NEWLINE <== 10; | ||
// - ASCII char: ` ` | ||
signal output SPACE <== 32; | ||
//-Escape-------------------------------------------------------------------------------------// | ||
// - ASCII char: `\` | ||
signal output ESCAPE <== 92; | ||
//-Number_Remapping---------------------------------------------------------------------------// | ||
signal output NUMBER <== 256; // past a u8 -- reserved for ANY numerical ASCII (48 - 57) | ||
} | ||
|
||
template Command() { | ||
// STATE = [pushpop, stack_val, parsing_string, parsing_number] | ||
signal output NOTHING[4] <== [0, 0, 0, 0 ]; // Command returned by switch if we want to do nothing, e.g. read a whitespace char while looking for a key | ||
signal output START_BRACE[4] <== [1, 1, 0, 0 ]; // Command returned by switch if we hit a start brace `{` | ||
signal output END_BRACE[4] <== [-1, 1, 0, 0 ]; // Command returned by switch if we hit a end brace `}` | ||
signal output START_BRACKET[4] <== [1, 2, 0, 0 ]; // TODO: Might want `in_value` to toggle. Command returned by switch if we hit a start bracket `[` (TODO: could likely be combined with end bracket) | ||
signal output END_BRACKET[4] <== [-1, 2, 0, 0 ]; // Command returned by switch if we hit a start bracket `]` | ||
signal output QUOTE[4] <== [0, 0, 1, 0 ]; // TODO: Mightn ot want this to toglle `parsing_array`. Command returned by switch if we hit a quote `"` | ||
signal output COLON[4] <== [1, 3, 0, 0 ]; // Command returned by switch if we hit a colon `:` | ||
signal output COMMA[4] <== [-1, 4, 0, -1 ]; // Command returned by switch if we hit a comma `,` | ||
signal output NUMBER[4] <== [0, 0, 0, 1 ]; // Command returned by switch if we hit some decimal number (e.g., ASCII 48-57) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Notes | ||
|
||
## JSON Types | ||
- [x] Object | ||
- [x] String | ||
- [ ] Array (PARTIALLY COMPLETED, TODO: Need to parse internally) | ||
- [ ] Number | ||
- [ ] Boolean | ||
- [ ] Null | ||
|
||
## Expected Output | ||
> This is old at this point, but we should update it. | ||
``` | ||
Notes: for `test.json` | ||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
POINTER | Read In: | STATE | ||
------------------------------------------------- | ||
State[1] | { | PARSING TO KEY | ||
------------------------------------------------- | ||
State[7] | " | INSIDE KEY | ||
------------------------------------------------- | ||
State[12]| " | NOT INSIDE KEY | ||
------------------------------------------------- | ||
State[13]| : | PARSING TO VALUE | ||
------------------------------------------------- | ||
State[15]| " | INSIDE VALUE | ||
------------------------------------------------- | ||
State[19]| " | NOT INSIDE VALUE | ||
------------------------------------------------- | ||
State[20]| " | COMPLETE WITH KV PARSING | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
State[20].next_tree_depth == 0 | VALID JSON | ||
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx | ||
``` |