cdfa / frugel

An error-tolerant live programming environment (my Master's thesis)
GNU General Public License v3.0
18 stars 3 forks source link

More efficient linearization #16

Open cdfa opened 2 years ago

cdfa commented 2 years ago

Currently, the number of linearization variations grows exponentially with the number of construction sites (in the worst case where none are nested). This could be improved by finding parts of the grammar which naturally isolate syntax errors (and corresponding AST nodes) and only reparsing linearized variations of those parts.

In more detail (probably only comprehensible to me):

  1. Find stoppers by finding loops in the grammar. All parents outside the loop are stoppers.
  2. Partition AST based on isolated loops. This isolates syntax errors and reduces the number of linearizations
  3. Within each partition: decompose nodes on paths to (nested) construction sites instead of linearizing complete partition (combats exponential complexity of variations). Still generate exponential number of variations. This way, we can be conservative with the combination of ambiguity and nested construction sites
  4. Parsing only has to consider partitions