[Haskell-cafe] parsing exercise

Stephen Tetley stephen.tetley at gmail.com
Sun Jan 23 09:23:25 CET 2011


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 Extension".

In practice, if you follow the skeleton syntax tree style you might
find "not caring" about the details of syntax is almost as much work
as caring about them. I've tried a couple of times to make a skeleton
parser that does paren nesting and little else, but always given up
and just used a proper parser as the skeleton parser never seemed
robust.



More information about the Haskell-Cafe mailing list