Skip to content

[JsLIGO] Redesign of the CST and grammar

We need less nodes, a uniform naming convention, alphabetic order etc. The current JsLIGO CST is out of phase with the way CameLIGO's is defined, and there are errors (like wrong associativity of selection in module paths), all the way back to the inception of the CST. The grammar will also need to allow more attributes in more places.

Another important sub-issue is the ASI (Automatic Semicolon Insertion), which is a heuristic implemented as a self-pass on the tokens and is very brittle (often noticed by puzzled users).

Another one is to distinguish the parsing of function parameters from tuples: currently tuples are assumed until a => is read. This leads to an expression to be parsed instead of parameter declarations (with patterns). The obvious change in the grammar yields a nasty LR conflict, so some effort needs to be put to fix it. (This is known since mid-december 2019 IIRC.) This is currently handled by a heuristic self-pass inserting the virtual token ES6FUN in front of tuples "that look like function parameters" -- very brittle.

Edited by Ghost User