I’ve been chipping at some scattered chess analysis projects recently and ended up writing something that I thought might stand up as its own niche package, a parser for “Portable Game Notation” (PGN) for standard chess, shnewto/pgn. So many of history’s great games are recorded as PGNs
(For anyone curious, here’s the Wikipedia page for PGN so you don’t need to go looking https://en.wikipedia.org/wiki/Portable_Game_Notation)
The PGN spec I referenced says that the input format of PGN files needs to be ‘rather flexible’ and I’ve tried to err in that direction but am still thinking on a few things. Currently comments are only handled in the text that describes the actual moves of the game (as opposed to the tags that describe it), and I’ve specified a concrete set of characters that are permitted as move descriptions (I’m sure both of those decisions will give me plenty of good excuses to revise things down the line haha).
It was my first real bout with elm/parser and I ended up feeling pretty fond of it. It wasn’t all smooth sailing while I figured approaches to nested patterns, optional patterns, and when after checking for those, to be explicit about backtracking. But every little level up was satisfying and I’m looking forward to my next opportunity to use it and level up some more.
Thanks for taking a look it you decide to!