roc icon indicating copy to clipboard operation
roc copied to clipboard

DRAFT: Better handle ambiguous parsing

Open gamebox opened this issue 5 months ago • 0 comments

This is A DRAFT. Feedback is welcome, but understand this will take a number of days to complete. I will post my work at the end of every day that I work on it. Hit me on Zulip if you want to talk about the approach in more detail.

Here is the high level plan:

  • Untyped parse nodes
  • Unified structure for all nodes that appear in two or more node types (Pattern, Expr, and TypeAnno)
  • Add parseUntypedNode function and related bits to parser
    • Only called in ambiguous parsing contexts like: Beginning of statement that does not state with keyword; Parsing top of block/record in expr parsing.
  • Untyped scratch
  • Functions to convert from untyped to typed nodes (hopefully just change tag)
  • After conversion, continue parsing where it would have been if we knew the type from the start.

gamebox avatar Jun 29 '25 12:06 gamebox