The canonical source for all this type of Calendar Calculations is from Nachum Dershowitz and Ed Reingold. At first it was the most requested SP&E paper of all time; it was a book; this is now in the third edition. Once you could download Lisp code, but this function seems to have disappeared from the web page. There is also an applet, and it's easy to override; I have implemented implementations in Icon and in Lua.
So, I suggest that you really want, this is their library, and then if you want to have a parser for this, you know how to do it.
source share