Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Second this. Recursive descent parsers are much easier in the long run, even if you can't immediately see your grammar after they have grown for a while.


I would agree but...

From trying to understand parsing and RDPs I think I don't have the part of the brain required to understand it.

Not that it isn't simple, it is. But it seems examples (as usual) overexplain the simple things then overlook something that seems obvious but isn't.

The only time I managed to write a parser for simple math that wasn't an example was through the use of 'reverse production' parsing. Yes, it's the worse way, but it worked for me (this was a long time ago though)


Try this from Crenshaw. Its old but just assumes basic programming skills (even if you olnly know javascript its close enough)

I manged to follow it when i was 14, when i found it on one of the newsgroups.

https://compilers.iecc.com/crenshaw/

here is port of code to C https://github.com/lotabout/Let-s-build-a-compiler




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: