Skip to content

Latest commit

 

History

History
24 lines (20 loc) · 721 Bytes

README.md

File metadata and controls

24 lines (20 loc) · 721 Bytes

Example grammar for JSON

File grammarjson.ebnf contains an example grammar for JSON. The example application in file testgrammarjson.d parses a JSON file and prints the resulting parse tree.

The application can be built with the following command:

dub build

The following command runs the application on the JSON file dub.json:

./example_json dub.json

It is also possible to test the grammar on test cases from https://github.com/nst/JSONTestSuite using the argument --test-dir:

git clone https://github.com/nst/JSONTestSuite.git
./example_json --test-dir JSONTestSuite/test_parsing

It will only print on errors, so the expected output is empty.