[Haskell-cafe] Re: Scheme in Haskell, Parsec Example, how to add scheme comments

Berlin Brown berlin.brown at gmail.com
Sun Nov 18 19:37:04 EST 2007


On Nov 18, 2007 7:32 PM, Berlin Brown <berlin.brown at gmail.com> wrote:
> I am sure many of you have looked at the scheme in haskell example that
> is on the web by Jonathan Tang. If you are familiar with the code, I
> need a little help trying to add scheme style comments:
>
> "; This is my comment"
>
> I added this code here and I think it works (I replaced the name
> parseSpaces with his "spaces" function).  But, if I start a line with a
> comment, it errors out with unbound variable.  Anybody have any ideas?
>
> -- Added the ';'
> symbol :: Parser Char
> symbol = oneOf ";!$%&|*+-/:<=>?@^_~#\n"
>
> --
> -- Handle whitespace and comments
> parseSpaces :: Parser ()
> parseSpaces = (try oneLineComment) <|> whiteSpace <|> return ()
>     where
>       whiteSpace = do skipMany1 space
>                       parseSpaces
>       oneLineComment = do { try (string ";")
>                           ; skipMany (satisfy (/= '\n'))
>                           ; parseSpaces
>                           }
>
> http://halogen.note.amherst.edu/~jdtang/scheme_in_48/tutorial/overview.html
>
>
>

Sorry, I am using the full scheme parser in this example:
http://halogen.note.amherst.edu/~jdtang/scheme_in_48/scheme_in_48.zip


-- 
Berlin Brown
http://botspiritcompany.com/botlist/spring/help/about.html


More information about the Haskell-Cafe mailing list