[Haskell-cafe] Very simple parser
gregorypropf at yahoo.com
Mon Jul 2 17:25:57 EDT 2007
As a programming exercise I'm trying to use the State monad to create a simple parser. It's for a very simple assembly language for a simple virtual machine. The state is a string of instructions. I want to be able to call something like getNextInstruction to pull out the next instruction and then update the state (string). I know I can do this non-monadically by just passing the string explicitly each time but I'd like to learn more about the State monad. I also know about Parsec and Happy and so forth but this is just an exercise so I want to do it this way. Any ideas? I can't seem to get anything to work. I've tried different things but I suspect I'm just missing something basic. Can someone post a simple prototype for this? Just assume the instructions are integers.
Get the Yahoo! toolbar and be alerted to new email wherever you're surfing.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe