#Data parsing resources

1 messages · Page 1 of 1 (latest)

tepid plover
#

I would like to implement JSON parsing in Java, for now as a fun challenge.
I'm already taking inspiration from several existing repo's like GSON and some others,
but I would appreciate it if you could share some resources that describe the process of making a parser.

It doesn't necessarily have to be in Java, just want to check out the process.

scenic hingeBOT
#

<@&987246399047479336> please have a look, thanks.

tepid plover
#

The bot shared repositories I'm already looking at

#

I'd like some more learning based things like articles / even books?

shrewd flint
#

@tepid plover well, when I made my json thing I mostly copied the parser logic from clojure core.json

#

But I did my edn parser by myself literally one character at a time

tepid plover
#

My problem is more the steps taken to get there

#

why do people implement it like it's done in these libraries

shrewd flint
#

Well option 1

#

You load in a string and parse the string

#

You don't want to do that because you kinda want to be able to read from a source that streams

#

So you read one character at a time

#

If you read one character at a time you kinda need some mechanism to know "I am in ___ state now"

#

Like each character needs to update the state of the parser

#

And then you sorta reach the "end"

#

But if you don't want streaming parsing then you can just do a "recursive descent" parser

#

Which I think is what I did but I don't remember at this point

scenic hingeBOT
#

@tepid plover

Your question has been closed due to inactivity.

If it was not resolved yet, feel free to just post a message below
to reopen it, or create a new thread.

Note that usually the reason for nobody calling back is that your
question may have been not well asked and hence no one felt confident
enough answering.

When you reopen the thread, try to use your time to improve the quality
of the question by elaborating, providing details, context, all relevant code
snippets, any errors you are getting, concrete examples and perhaps also some
screenshots. Share your attempt, explain the expected results and compare
them to the current results.

Also try to make the information easily accessible by sharing code
or assignment descriptions directly on Discord, not behind a link or
PDF-file; provide some guidance for long code snippets and ensure
the code is well formatted and has syntax highlighting. Kindly read through
https://stackoverflow.com/help/how-to-ask for more.

With enough info, someone knows the answer for sure 👍

tepid plover
#

For your JSON lib you didn't make it recursive

#

It's a state machine

#

Gson also does that

#

So it sounds reasonable

#

Is there any website with the requirements for JSON?

#

I found the 'json grammar' website already but some people were talking about encoding specs