3 ms·
The article is fine, except for the example, and I suppose by extension, the grammar of the lang itself. The example: 2+3*4-1 should resolve to either LR: 19 R
by lkey 9mo ago
The article is fine, except for the example, and I suppose by extension, the grammar of the lang itself.
The example: 2+3*4-1 should resolve to either
LR: 19
RL: -7
PEMDAS: 13
and never this: 15
Who would expect a language where add/sub is more tightly binding than mul?
Its feels akin to starting your indexes at 2, it's not illegal, if you remember everything works, but its a true foot gun in a scripting lang.
- masklinn 9mo agoWouldn’t RL be 11? 2+(3(4-1)) = 2+(33) = 2+9
- lkey 9mo agoDepends on how you interpret (4-1) in your rl lang, 3 or -3.
- xnacly 9mo agoIm sorry i forgot to highlight the braces around (2+3)*(4-1); Either way the parser isnt implemented yet and all ast examples for the compiler are hardcoded