News for hackers. Stuff that matters.
Re:Ask HN: Writing a recursive descent parser for arithmetic... by bd82 on Wednesday May 09, 2018 @03:16AM (#17027957)
Maybe this example will help? https://github.com/SAP/chevrotain/blob/master/examples/gramm...

It is implemented using a parsing library so the lookaheads are automatically performed by the library, but the general pattern is still relevant.

Basically each binary precedence level gets a rule (weakest first) and each of these rules will consume as many operators of the current precedence level as it can.

There are no comments on this comment yet.