Skip to content

Implemented a JSON parser. #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft

Implemented a JSON parser. #6

wants to merge 3 commits into from

Conversation

itssamuelrowe
Copy link
Owner

The following tasks are achived in this pull request:

  1. Implement an LL(1) lexer and the parser for the JSON specification. Both the lexer and the parser are integrated in the same structure for the sake of simplicity.
  2. Implement a serializer that convert a JSON value to JSON string.

This commit implements an LL(1) lexer and the parser for the JSON specification.
Both the lexer and the parser are integrated in the same structure for the
sake of simplicity.

There is no buffering of tokens. Any token produced by the lexer is immediately
consumed by the parser. In fact, the parser triggers the lexer to create a token
only when it requires one.
@itssamuelrowe itssamuelrowe requested a review from a user June 24, 2020 09:31
@itssamuelrowe itssamuelrowe self-assigned this Jun 24, 2020
@itssamuelrowe itssamuelrowe added the enhancement New feature or request label Jun 24, 2020
@ghost ghost self-requested a review June 24, 2020 15:49
The destructor recursively traverses the object tree releasing memory accordingly.
Since, key-value pairs are stored in a hash map, the key needs to persist longer
than the lifetime of a token, which is where we derive the key from. As of now,
tokens are not freed. In the future, we need to implement a recyclable token
that is destroyed along with the parser.

Removed the `TokenChannel` enumeration because the tokens are always generated on
the default channel, given we don't generate tokens for whitespace.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant