4
lorentz
214d

I'm sure this has been discovered before but I just realized that a lexer defined as a set of functions which tail-call each other with the leftover text to switch states can record the location of tokens from the back of the string, thereby eliminating a parameter from pretty much every function. The world is full of wonder.

Comments
  • 0
    Obviously.

    Just kidding, I don’t have a clue what you are talking about. 😅

    But I find it interesting, as always.
  • 0
    Tail calls aren't supported in debug builds so I had to use a trampoline and now everything sucks
Add Comment