Johannes Waldmann wrote: > Imagine you're writing a parser for a simple programming language. > A program is a sequence of statements. > Fine, you do "readFile" (once) and then apply a pure Parsec parser. > > Then you decide to include "import" statements in your language. > Suddenly the parser needs to do IO. Assume the import statements > need not be the first statements of the program > (there may be headers, comments etc. before). > Then you really have to interweave the parsing and the IO. > > If anyone has a nice solution to this, please tell. - J.W.
Design your language in a way that the *parse* tree does not depend on import statements? I.e. Chasing imports is performed after you've got an abstract syntax tree. Regards, apfelmus _______________________________________________ Haskell-Cafe mailing list [email protected] http://www.haskell.org/mailman/listinfo/haskell-cafe
