module HW7_2 where import HW7_1 data Expr = Xml String [Expr] | Str String deriving Show token p = do x <- p many whiteSpace return x {- Xml ::= < Id > Body Body ::= Xml* | String Id ::= identifier String ::= [^ '<']* -- 0 or more characters which are not '<' Examples: run xml "" ==> Ok: Xml "a" [] run xml " hello bye " ==> parse error at (column 10, line 0): unexpected run xml " hello bye " ==> Ok: Xml "a" [Xml "b" [Str "hello "],Xml "c" [Str "bye "]] run xml " hello bye " ==> parse error at (column 14, line 0): unexpected White space shouldn't matter, so "< / a >" is equivalent to "". Don't worry about escape sequences in strings, i.e. "\\n" -} xml :: Parser Expr xml =