5 ms·
It’s a little strange that we have to put a type on the right and something like “var” on the left. “Constant int” and “variable int” should be types.
by erik_seaberg 4y ago
It’s a little strange that we have to put a type on the right and something like “var” on the left. “Constant int” and “variable int” should be types.
- 082349872349872 4y agoLooking at the Edinburgh school as a whole, many of their language families started out as pure precedence-based expression languages, requiring no "parsing" (in the BNF->LALR sense). Their recent descendants have all wound up with noise tokens to be parsed at the upper levels; presumably this helps with error {detection, recovery, messages}. My guess is that the "var" on the left plays less a typing role and more a "make this obviously syntactically a declaration" role.
- erik_seaberg 4y agoYeah, it’s best for a grammar to somehow avoid the typedef problem, where “x * y” might become a declaration if x turns out to be a type. Maybe “id : type = value” doesn’t always do that?