Skip to content

Instantly share code, notes, and snippets.

@DmitrySoshnikov
Created January 10, 2016 04:40
Show Gist options
  • Save DmitrySoshnikov/a0133943e30d1edacbc3 to your computer and use it in GitHub Desktop.
Save DmitrySoshnikov/a0133943e30d1edacbc3 to your computer and use it in GitHub Desktop.
json.bnf
%token STRING NULL NUMBER TRUE FALSE
%start JSONText
%%
JSONText : JSONValue;
JSONString : STRING;
JSONNullLiteral : NULL;
JSONNumber : NUMBER;
JSONBooleanLiteral : TRUE
| FALSE
;
JSONValue : JSONNullLiteral
| JSONBooleanLiteral
| JSONString
| JSONNumber
| JSONObject
| JSONArray
;
JSONObject : '{' '}'
| '{' JSONMemberList '}'
;
JSONMember : JSONString ':' JSONValue;
JSONMemberList : JSONMember
| JSONMemberList ',' JSONMember
;
JSONArray : '[' ']'
| '[' JSONElementList ']'
;
JSONElementList : JSONValue
| JSONElementList ',' JSONValue
;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment