Hacker News new | ask | show | jobs
by bd82 2965 days ago
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.