Hello. Can anyone help me writing a parser for parsing a simplified list of ABC fields (http://www.gre.ac.uk/~c.walshaw/abc/).
The grammar I want to test with is the following ------------------ file ::= *field field ::= fieldA | fieldB fieldA ::= "A:" text endOfLine fieldB ::= "B:" text endOfLine restTextB restTextB ::= (text endOfLine) 'not starting with "A:" or "B:"' text ::= *(LETTER | DIGIT | SPACE | ":") endOfLine ::= LF | CR LF ------------------ The parser I am trying: ------------------ file = many field field = fieldA <|> fieldB fieldA = do string "A:" text endOfLine fieldB = do string "B:" text endOfLine restTextB -- not starting with "A:" or "B:" restTextB = do text endOfLine text = many (letter <|> digit <|> space <|> char ':') endOfLine = string "\n" | string "\r\n" ------------------ Example of input: ------------------ A:1 B:Traditional A:2 B:Line 1 Line 2 A Line 3 BBLine 4 A:3 ------------------ Any sugestion on how to implement the 'not starting with "A:" or "B:"' problem? Romildo -- Prof. José Romildo Malaquias Departamento de Computação - Universidade Federal de Ouro Preto http://www.decom.ufop.br/prof/romildo/ [EMAIL PROTECTED] http://uber.com.br/romildo/ [EMAIL PROTECTED] _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell