GMPParser.hs revision f36b9db17fd6c5a36f1a0549968f4d7748080a15
1a879e0f576d139dcd52e6d8ec958b4a3c169846Jens Elkner----------------------------------------------------------------
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa-- the Generic Model Parser Abstract Syntax
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa-- Copyright 2007, Lutz Schroeder and Georgel Calin
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa----------------------------------------------------------------
1a879e0f576d139dcd52e6d8ec958b4a3c169846Jens Elknermodule GMPParser where
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksaimport qualified Text.ParserCombinators.Parsec.Token as P
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa-----------------------------------------------------------
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa-- The Parser Things
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa-----------------------------------------------------------
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksapar5er :: Parser String
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa do try(string "F"); return "F"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string "T"); return "T"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string "~"); return "Not"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string"/\\") ; return "And"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string "\\/"); return "Or"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string "->"); return "If"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string "<-"); return "Fi"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do try(string "<->"); return "Iff"
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa{- the parser should actually look somewhat like the following
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksapar5er :: Parser Formula
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksapar5er = do Text.ParserCombinators.Parsec.try(string "F");
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do Text.ParserCombinators.Parsec.try(string "T");
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do Text.ParserCombinators.Parsec.try(string "~");
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do Text.ParserCombinators.Parsec.try(string "/\\");
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do Text.ParserCombinators.Parsec.try(string "\\/");
a389e88e0acb83d8489bdc5e55bc5522b152bbecEugen Kuksa <|> do Text.ParserCombinators.Parsec.try(string "->");
lexer = P.makeTokenParser gmpDef
lexeme = P.lexeme lexer
parens = P.parens lexer
braces = P.braces lexer
semiSep = P.semiSep lexer
semiSep1 = P.semiSep1 lexer
commaSep = P.commaSep lexer
commaSep1 = P.commaSep1 lexer
whiteSpace = P.whiteSpace lexer
symbol = P.symbol lexer
identifier = P.identifier lexer
reserved = P.reserved lexer
natural = P.natural lexer