Open DavePearce opened 9 years ago
One issue here is that making it a grammatical issue will affect what kind of error message is reported. For example, consider these two messages:
error: unexpected token encountered if (1,2): ^
versus:
error: expected type bool, found (int,int) if (1,2): ^^^^^
The former represents a grammatical error, whilst the latter represents a type error.
One approach here would be to mix type and grammatical rules together. This might not be as crazy as it sounds, provided it was described properly.
Currently, the grammar used for describing Whiley statements and expressions is imprecise in certain ways. For example when describing the syntax for an if statement, the condition is defined as a generic
Expr
, when in fact it can only be a boolean expression.The question is whether or not we can describe this and, if so, do we want to?