Could anybody explain me how to organize parsing in Haskell ?
Examples.
lex " ( + 2 3)" --> [ ( "(", " + 2 3)" ) ]
- it does too little, only separates one lexeme.
reads " 12+3" :: [(Int,String)] --> [ (12, "+3" ) ]
reads " (1+2)" :: [(Int,String)] --> []
- this is poor too.
And what I need is like this:
parse? " 1+2* 3 +4 x 2" -->
[ ( "(+ (+ 1 + (* 2 3)) 4)", " x 2" ) ]
Here the operation arities and priorities may be of the Haskell
program syntax ones, but it is better to give them explicitely in
additional argument of `parse?'.
If one has such Standard parse, then one can obtain canonical
string and further read it to Haskell data as one likes.
Am I missing something ?
Thanks.
Sergey Mechveliani [EMAIL PROTECTED]