Visual parsing debugger for PDF in elm

I need to extract partial data from PDF’s and pdf.js library is to high level and bloated for my case.
While creating my PDF parser i stumbled upon a lot wird stuff and debugging took forever.
So I built myself a visual debugger that shows the state, incoming bytes and resulting drawing
It is more or less the same as elm debugger… where msg and model is replaced with bytes and state.
The actual handleByte function is used in parser and debugger, so changes is hot reloaded and the result is “instantly” visible when changing parser logic thanks to the amazing elm-watch.
Making debugging wierd stuff straight forward :slight_smile:

So this is a tip for other people having a state-machine-style parser. I can now see the problem instantly instead of starting to add logging and stuff and start figuring out where stuff went wrong.

I just made a video explaining how PDF works under the hood using the debugger:


Pretty awesome, I must say.

1 Like

That’s awsome.

Writing a pdf parser is on my todo.

I’ve never thought writing is in Elm. I was thinking about Elixir since it has binary pattern matching and there is already some litterature.

But I would love to do it Elm, especially to enable building a webapp on top of it.

Do you have any code to share ?


This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.