Skip to content

Conversation

natecook1000
Copy link
Owner

The shared DSLTree type that is used to store the pre-compilation regex pattern is an indirect enumeration that has arbitrary nesting/recursion. This design makes it challenging both to reference different parts of the tree and to manipulate the tree during compilation for pre- and mid-compilation optimizations.

This change introduces a DSLList type that stores a pre-order traversal of the tree in an array, and an alternate bytecode generation path that consumes the DSLList instead of recursing over the DSLTree, with tests that the generated bytecode is identical between the two structures.

Still to do:

  • switch actual bytecode generation to the DSLList
  • eliminate use of the DSLTree representation
  • modify the nodes to store only a child count instead of the children themselves
  • generate the DSLList directly from parsing/instantiation

This implements bytecode generation from a DSLList instead of a
DSLTree. The change includes tests that all regex patterns in the
`MatchTests` file produce the exact same bytecode from a list as from
a tree.
@natecook1000 natecook1000 deleted the flatten-dsltree branch October 4, 2025 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant