tags: syntax parsing parent: if expression
Parentheses Around the Condition
To disambiguous parsing of if expression, some delimitator need to be added between if and condition. Different languages uses different solutions. Most C-style languages require parenthesis around condition like this
if (cond) block;Even though the first ( is not useful.
Alternatively, languages like go or Rust requires braces around statements.
if cond { statements; }And some other languages like ML or Python requires a then keyword or some other delimitator token.
if cond then e1 else e2