Patrick Dubroy
@dubroy
Compiler buds, need your opinion —

In @WasmGroundUp, we build a tiny compile-to-Wasm language. To keep the grammar simple, there's no arithmetic precedence.

Also, we match binary ops iteratively, not recursively (see `Expr` in img).

Q: Does the latter seem too non-standard?
Tweet image
Mar 11, 2024 · 4 · 1

@WasmGroundUp The problem is that doing it recursively in @_ohmjs requires at least a minimal discussion of left recursion.

(Below is a more typical way to handle binary operators in Ohm.)
Tweet image

@WasmGroundUp @_ohmjs Ok, turns out that @ziglang does it exactly this way. That makes me feel better.

(And TIL that the official Zig grammar is a PEG! github.com/ziglang/zig-sp…)
Tweet image

https://twitter.com/dubroy/status/1767218005488943364 ∙ Archived on 2025-03-28.

← Twitter Archive: 2024