Re: [Haskell-cafe] parsing exercise

2011-01-23 Thread Stephen Tetley
I don't think you can do this simply as you think you would always have to build a parse tree. If the input is valid Haskell you could follow Chung-chieh Shan's suggestion, otherwise you could parse to a skeleton syntax tree - look for work by Jonathan Bacharach on Dylan macros and Java Syntax

Re: [Haskell-cafe] parsing exercise

2011-01-23 Thread Sebastian Fischer
On Sun, Jan 23, 2011 at 4:31 PM, Chung-chieh Shan ccs...@post.harvard.eduwrote: Maybe Text.Show.Pretty.parseValue in the pretty-show package can help? That's what I was looking for, thanks! On Sun, Jan 23, 2011 at 5:23 PM, Stephen Tetley stephen.tet...@gmail.com wrote: I don't think you

[Haskell-cafe] parsing exercise

2011-01-22 Thread Sebastian Fischer
Hello, I need a function and wonder whether I can copy some existing code so I don't have to write it myself. It should split a string into a list of strings: splitAtTopLevelCommas :: String - [String] I need something similar to `splitOn ,` from the Text package with the property

Re: [Haskell-cafe] parsing exercise

2011-01-22 Thread Alex Rozenshteyn
You might want to check out parsec, and the chapter related to it in RWH. http://book.realworldhaskell.org/read/using-parsec.html On Sun, Jan 23, 2011 at 12:09 AM, Sebastian Fischer fisc...@nii.ac.jpwrote: Hello, I need a function and wonder whether I can copy some existing code so I don't

Re: [Haskell-cafe] parsing exercise

2011-01-22 Thread Chung-chieh Shan
Sebastian Fischer fisc...@nii.ac.jp wrote in article AANLkTimZfqoLG5z=vsxsjltn_r5xh+ed49-ngknhn...@mail.gmail.com in gmane.comp.lang.haskell.cafe: I expect writing this function to be quite tedious (ignore commas in parens, ignore parens in strings, quotation, ...) and would prefer to copy