Target Woes

Started writing a tiny grammar in Janet last night just to get a feel for it. Wrote one that matches my multi-line comments which I'll need for the initial pass of the parser.

Discovered some problems.

  1. Janet's PEG doesn't support unicode out of the box. It's stuck in ASCII land. Gods forbid anyone wants to try and match a string that was written in another language. You know, something really esoteric like Spanish, or French. 🤦‍♀️Technically it does support unicode but there's no easy way to do basic things like defining something that matches letters / word characters unless you're willing to limit your input to ASCII.
  2. It doesn't appear that grammars can use other grammars, which means each grammar must be self-contained. Not a big deal. Fairly standard actually, but it means you can't compose grammars.
  3. There's no good way to see which rule matched a given portion of the text. You can "tag" captured text, but it's only a thing used for referencing past matches within the grammar.
  4. Janet has no regular expressions. They explain this by saying that their PEG is better, and they've got some reasonable arguments, BUT we're back to unicode not being supported out of the box.

I use regular expressions a lot. I "cut my teeth" on Perl 5. I love them, and actually understand them at an expert level. The syntax is freaking horrible for newbs, but that's a separate discussion. Anyway…. no regexp is going to be a pain, and frankly I don't want to have to write unicode support into a regexp engine or a PEG.

This morning I decided to check in on the current state of Raku (a.k.a Perl 6), which has some amazing features, and I saw this piece of beauty.

a screenshot of a raku grammar. it is beautiful and has features i want.

ARG. I DON'T WANT TO BE SWITCHING LANGUAGES AGAIN.

I need this language to be done. Or, at least working. I need to get it out of my brain so that I can sleep again.