Skip to content

Instantly share code, notes, and snippets.

@jnthn

jnthn/report.md Secret

Created Jun 1, 2021
Embed
What would you like to do?

During May I focused on filling out the regex part of RakuAST, with the result that the majority of the constructs found in Raku regexes now have AST nodes and can be compiled by the RakuAST-based compiler frontend. Of note, I did AST nodes for:

  • Declarations in regexes (:my $foo)
  • Code-based assertions (<?{ ... }> and <!{ ... }>)
  • The \e, \f, \h, \r, \t, \v, and \0 escape sequences
  • Character classes, including the common <[a..z_]> style, Unicode properties (<:L>), rules <+rulename>, and the combination of these using + and -
  • Regex code evaluation (<{ ... }>)
  • Variable interpolation, both as data ($x) and in an assertion syntax as code (<$code>)
  • Internal modifiers (:i, :m, etc.)
  • Calls to lexical rules (<&rulename>), including passing of arguments

Furthermore, I corrected a mistake in handling of backtracking modifiers, and added a missing action method in the new compiler frontend that blocked regexes passing arguments from compiling.

Away from the regex language itself, I:

  • Implemented a mechanism for an AST node to specify it would like to participate in CHECK time and report problems
  • Implemented construction and collection of typed exceptions, both at CHECK time, but also so that the new compiler frontend can produce them. Probably some things that are done in the compiler frontend might want to become CHECK-time things in the AST nodes, since they can happen in synthetically constructed programs too. Those that are purely syntactic are often not possible to represent in the AST.
  • Added RakuAST nodes for token/rule declarations, so that grammars can now be expressed and compiled in RakuAST (without protoregexes so far, however)
  • Correctly set the scope on routine declarations
  • Added missing operator properties for bitshifts, so they can be compiled

All of this work won a rather underwhelming 17 extra fully passing spectest files; as has been previously noted, the test files are quite good at depending on a lot of language features.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment