You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Stanford CS240h 2011 Autumn
Is there a way to get the line and column numbers of the cursor out of attoparsec as you are parsing?
Drew Haven
unread,
Dec 2, 2011, 8:50:34 PM12/2/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to stanford-1...@googlegroups.com
If I recall, one of the ways Attoparsec gains its speed (as it is much faster than Parsec) is by sacrificing a lot of conveniences like tracking line and column numbers. You can use the <?> operator to set custom error messages though, which will help you identify why a failure occurs, but I don't know how to get the line/column number as you are going in case you wanted to do something like tagging tokens for errors during later analysis.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to stanford-1...@googlegroups.com, Drew Haven
So if I want those features, I'll need to use another parser, such
as parsec. Thanks for the info. Should it be straightforward to
convert attoparsec parsers to parsec parsers? Any good/recommended
tutorials on parsec? I found
http://book.realworldhaskell.org/read/using-parsec.html already,
which is proving helpful.
Drew Haven
unread,
Dec 3, 2011, 1:15:35 PM12/3/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Daniel Sommermann, stanford-1...@googlegroups.com
Exactly. I find this line in the lecture notes. I knew I remembered Brian mentioning it. Parsec is very similar, and I've used it in the past. Give it a look.
attoparsec does not attempt to give friendly error messages (no file names or line numbers). Parsec might be a better choice for e.g. parsing source files, where the friendliness/performance tradeoff is a little different.