-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjson.bnf
More file actions
46 lines (24 loc) · 1.2 KB
/
json.bnf
File metadata and controls
46 lines (24 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
;; -*- mode: text; coding: utf-8; indent-tabs-mode: nil; -*-
;; JSON grammar in Backus-Naur form
<json> ::= <element>
<value> ::= <object> | <array> | <string> | <number> | true | false | null
<object> ::= { <ws> } | { <members> }
<members> ::= <member> | <member> , <members>
<member> ::= <ws> <string> <ws> ":" <element>
<array> ::= [ <ws> ] | [ <elements> ]
<elements> ::= <element> | <element> , <elements>
<element> ::= <ws> <value> <ws>
<string> ::= '"' <characters> '"'
<characters> ::= "" | <character> <characters>
<character> ::= " " | . | # | ... | [ | ] | ...
<escape> ::= '"' | \ | / | b | f | n | r | t | u <hex> <hex> <hex> <hex>
<hex> ::= <digit> | A | B | C | D | E | F | a | b | c | d | e | f
<number> ::= <integer> <fraction> <exponent>
<integer> ::= <digit> | <onenine> <digits> | - <digit> | - <onenine> <digits>
<digits> ::= <digit> | <digits> <digit>
<digit> ::= 0 | <onenine>
<onenine> ::= 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
<fraction> ::= "" | . <digits>
<exponent> ::= "" | E <sign> <digits> | e <sign> <digits>
<sign> ::= "" | + | -
<ws> ::= "" | <HT> <ws> | <LF> <ws> | <CR> <ws> | <SP> <ws>