I've written several programs in F#, and although I come from an extensively imperative background, I'm not a noob by any means.
But dang this FParsec is tough. I read the tutorial three times. I get the idea that you chain together functions, sort of like regex, and then you can cast the results into your AST.
What I don't get is things like: If I have two functional searcher thing-a-ma-bobs, once they find their targets, how do I tell the system to keep looking for their next matches? I think this is in the structure of how the parsers are set up, but the simple one-line examples don't really answer that.
Also, when adding these parsers in, the compiler can't infer the types, so I get error messages for simple "let" statements -- until I hook them all up later. That means there can be any combinatorial parser pieces lying around unused? Sounds kind of weird.
And just what _are_ the arguments to these parsers and combinators, anyway? Sometimes they stand alone, sometimes you have to give them an integer, sometimes you have to put parenthesis around entire groups, sometimes you don't. I understand that the answer to my question is in the type signatures, but these are some seriously butt-ugly type signatures. And from the tutorial and help pages I'm not always sure which Parser<_,_> is doing what to whom.
So is there another resource for FParsec? I've got the simplest problem imaginable: I have straight text I want to leave alone. Sprinkled throughout the text I have "commands" which are delimited by #$# around the Command Name. Basically it's just MadLibs.
All I need to do is leave the text alone, identify the commands, and run them to find new text to insert in the stream. This shouldn't be rocket science. Heck, it shouldn't be but a few lines of code. But it's got me baffled.
Any help is greatly appreciated. I've been at this for a couple of days with mixed results and I really hope you guys can offer some assistance.