4 ms·
The waz I solve this in my parsers, is that I have a generic "node" syntax that isn't differentiated between types and expressions. So e.g. x[1] : array[in
by tomp 6y ago
The waz I solve this in my parsers, is that I have a generic "node" syntax that isn't differentiated between types and expressions. So e.g.
x[1] : array[int]
would be parsed as
cast(item(ident("x"), int("1")), item(ident("array"), ident("int")))
Then the semantic disambiguation (`x[1]` -> expression, `array[int]` -> type) would be done in the next stage.