instaparse 2023-04-07

I'm working on a Lexer as part of following along with my college course on compilers. I tried to refactor my handwritten scanner for AS ::= { peter | petra | anna }, but didn't have much success using instaparse. Am I hitting a hammer with a chainsaw or am I missing something obvious? My small lexer is best viewed through this Clerk Notebook: https://port19.xyz/compnotes/

Instaparse is, I believe, a scannerless parser, meaning it is more powerful than a scanner (it can construct parse trees, not just return a stream of tokens), and also skips the intermediate step of scanning input into a stream of tokens and then build parse trees out of the stream of tokens

So I am not sure why you would use it to construct a scanner

Are you aware of some scanner generator library? Or should I take this as an opportunity to write a scanner generator myself, perhaps even with macros if possible?