Re: [Haskell-cafe] parsing exercise

2011-01-23 Thread Sebastian Fischer
On Sun, Jan 23, 2011 at 4:31 PM, Chung-chieh Shan wrote: > 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 wrote: > I don't think you can do this "simply" as you think you would alw

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-22 Thread Chung-chieh Shan
Sebastian Fischer wrote in article 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 code from > some parsing library. Do you have an idea what I could use? Or how

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 wrote: > Hello, > > I need a function and wonder whether I can copy some existing code so I > don't have to write

[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 i