Hacker News new | ask | show | jobs
by smitchell2 2620 days ago
I would suggest Recursive Descent for general parsing, and Precedence Climbing for expressions.

Once you get the hang of Recursive Descent, parsing becomes mechanical. And with Precedence Climbing for expressions, you just plug in the appropriate operator priorities.

Some of the literature below refers to "parsing" as "syntax analysis".

See this introductory set of articles:

https://www.semware.com/html/compiler.html

Then see this (small, 160 page) book from Wirth:

http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf

See examples here - especially the C and Python examples: (lexical analysis examples included, since it must feed the parser)

http://rosettacode.org/wiki/Compiler/lexical_analyzer

http://rosettacode.org/wiki/Compiler/syntax_analyzer