Copyright | (c) Dominik Dietrich DFKI Bremen 2010 |
---|---|
License | GPLv2 or higher, see LICENSE.txt |
Maintainer | dominik.dietrich@dfki.de |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Parser for abstract syntax for CSL
Synopsis
- parseBasicSpec :: Maybe (PrefixMap -> AParser st BASIC_SPEC)
- parseSymbItems :: Maybe (GenParser Char st SYMB_ITEMS)
- parseSymbMapItems :: Maybe (GenParser Char st SYMB_MAP_ITEMS)
- addToPosition :: SourcePos -> SourcePos -> SourcePos
- posInputParser :: a -> GenParser tok st (a, SourcePos, [tok], st)
- runSubParser :: GenParser tok st a -> st -> SourceName -> GenParser tok st' (Either ParseError (st, a))
- data OpVarState a = OpVarState a (Set String)
- runWithVars :: OperatorState a => [String] -> CharParser (OpVarState a) res -> CharParser a res
- parseError :: String -> CharParser st a
- pComma :: CharParser st String
- pSemi :: CharParser st String
- lstring :: String -> CharParser st String
- lexemeParser :: CharParser st a -> CharParser st a
- getOpName :: String -> [OPNAME] -> OPNAME
- mkFromOps :: [OPNAME] -> String -> [EXPRESSION] -> EXPRESSION
- identifier :: CharParser st Token
- prefixidentifier :: CharParser st Token
- signednumberExp :: CharParser st EXPRESSION
- signednumber :: CharParser st (Either APInt String, Range)
- readRat :: String -> APFloat
- readDbl :: String -> Double
- keySignNumCompat :: CharParser st a -> CharParser st a
- signNumCompatChars :: String
- oneOfKeys :: [String] -> CharParser st String
- plusmin :: OperatorState st => CharParser st EXPRESSION
- factor :: OperatorState st => CharParser st EXPRESSION
- expexp :: OperatorState st => CharParser st EXPRESSION
- expatom :: OperatorState st => CharParser st EXPRESSION
- expsymbol :: OperatorState st => CharParser st EXPRESSION
- opdecl :: OperatorState st => CharParser st OpDecl
- listexp :: OperatorState st => CharParser st EXPRESSION
- intervalexp :: CharParser st EXPRESSION
- extparam :: CharParser st EXTPARAM
- parseVarList :: CharParser st EXPRESSION
- parseVar :: CharParser st EXPRESSION
- quantFormula :: OperatorState st => OPNAME -> CharParser st EXPRESSION
- truefalseFormula :: OperatorState st => CharParser st EXPRESSION
- predFormula :: OperatorState st => CharParser st EXPRESSION
- atomicFormula :: OperatorState st => CharParser st EXPRESSION
- aFormula :: OperatorState st => CharParser st EXPRESSION
- negFormula :: OperatorState st => CharParser st EXPRESSION
- parenFormula :: OperatorState st => CharParser st EXPRESSION
- impOrFormula :: OperatorState st => CharParser st EXPRESSION
- andFormula :: OperatorState st => CharParser st EXPRESSION
- formulaorexpression :: OperatorState st => CharParser st EXPRESSION
- command :: CharParser (AnnoState st) CMD
- reduceCommand :: OperatorState st => CharParser st CMD
- assignment :: OperatorState st => CharParser st CMD
- constraint :: OperatorState st => CharParser st CMD
- sequenceExpr :: CharParser (AnnoState st) CMD
- repeatExpr :: CharParser (AnnoState st) CMD
- singleCase :: CharParser (AnnoState st) (EXPRESSION, [CMD])
- caseExpr :: CharParser (AnnoState st) CMD
- opItem :: CharParser st OP_ITEM
- varItems :: CharParser st [VAR_ITEM]
- varItem :: CharParser st VAR_ITEM
- epDecl :: CharParser st (Token, EPDomain)
- epNumValAss :: CharParser st (Token, APInt)
- parseDomain :: CharParser st Domain
- parseEPVal :: CharParser st EPVal
- parseEPDomain :: CharParser st EPDomain
- basicSpec :: AParser st BASIC_SPEC
- parseBasicItems :: AParser st BASIC_ITEM
- parseOpDecl :: AParser st BASIC_ITEM
- parseVarDecl :: AParser st BASIC_ITEM
- parseEPDefValOrDomDecl :: AParser st BASIC_ITEM
- parseEPDecl :: AParser st BASIC_ITEM
- parseAxItems :: AParser st BASIC_ITEM
- symb :: GenParser Char st SYMB
- symbMap :: GenParser Char st SYMB_OR_MAP
- symbItems :: GenParser Char st SYMB_ITEMS
- symbs :: GenParser Char st ([SYMB], [Token])
- symbMapItems :: GenParser Char st SYMB_MAP_ITEMS
- symbMaps :: GenParser Char st ([SYMB_OR_MAP], [Token])
- parseCommand :: String -> Maybe CMD
- parseExpression :: OperatorState a => a -> String -> Maybe EXPRESSION
Interface to the syntax class
parseBasicSpec :: Maybe (PrefixMap -> AParser st BASIC_SPEC) Source #
parseSymbItems :: Maybe (GenParser Char st SYMB_ITEMS) Source #
parseSymbMapItems :: Maybe (GenParser Char st SYMB_MAP_ITEMS) Source #
Parser utils
:: SourcePos | original position |
-> SourcePos | relative position |
-> SourcePos | new position |
posInputParser :: a -> GenParser tok st (a, SourcePos, [tok], st) Source #
runSubParser :: GenParser tok st a -> st -> SourceName -> GenParser tok st' (Either ParseError (st, a)) Source #
data OpVarState a Source #
OpVarState a (Set String) |
Instances
OperatorState a => OperatorState (OpVarState a) Source # | |
Defined in CSL.Parse_AS_Basic addVar :: OpVarState a -> String -> OpVarState a Source # isVar :: OpVarState a -> String -> Bool Source # lookupOperator :: OpVarState a -> String -> Int -> Either Bool OpInfo Source # lookupBinder :: OpVarState a -> String -> Maybe OpInfo Source # |
runWithVars :: OperatorState a => [String] -> CharParser (OpVarState a) res -> CharParser a res Source #
parseError :: String -> CharParser st a Source #
lexemeParser :: CharParser st a -> CharParser st a Source #
parser for symbols followed by whitechars
mkFromOps :: [OPNAME] -> String -> [EXPRESSION] -> EXPRESSION Source #
Parser for Expressions
identifier :: CharParser st Token Source #
parsing of identifiers. an identifier is a letter followed by letters, numbers, or _, but not a keyword
prefixidentifier :: CharParser st Token Source #
signednumberExp :: CharParser st EXPRESSION Source #
parses a possibly signed number to an EXPRESSION
signednumber :: CharParser st (Either APInt String, Range) Source #
parses a possibly signed number (both integers and floats)
keySignNumCompat :: CharParser st a -> CharParser st a Source #
The version in Common.Lexer is not compatible with floating point numbers which may start with ".". This one does it. This version is still not compatible with -!
signNumCompatChars :: String Source #
plusmin :: OperatorState st => CharParser st EXPRESSION Source #
factor :: OperatorState st => CharParser st EXPRESSION Source #
parse a product of basic expressions
expexp :: OperatorState st => CharParser st EXPRESSION Source #
parse a sequence of exponentiations
expatom :: OperatorState st => CharParser st EXPRESSION Source #
parse a basic expression
expsymbol :: OperatorState st => CharParser st EXPRESSION Source #
opdecl :: OperatorState st => CharParser st OpDecl Source #
listexp :: OperatorState st => CharParser st EXPRESSION Source #
parses a list expression
intervalexp :: CharParser st EXPRESSION Source #
parser for extended parameter, e.g., [I=0,...]
parser for formulas
parseVarList :: CharParser st EXPRESSION Source #
parseVar :: CharParser st EXPRESSION Source #
quantFormula :: OperatorState st => OPNAME -> CharParser st EXPRESSION Source #
truefalseFormula :: OperatorState st => CharParser st EXPRESSION Source #
parser for atoms
predFormula :: OperatorState st => CharParser st EXPRESSION Source #
parser for predicates
atomicFormula :: OperatorState st => CharParser st EXPRESSION Source #
aFormula :: OperatorState st => CharParser st EXPRESSION Source #
parser for formulas
negFormula :: OperatorState st => CharParser st EXPRESSION Source #
parenFormula :: OperatorState st => CharParser st EXPRESSION Source #
parses a formula within brackets
impOrFormula :: OperatorState st => CharParser st EXPRESSION Source #
parser for implications and ors (same precedence)
andFormula :: OperatorState st => CharParser st EXPRESSION Source #
a parser for and sequence of and formulas
Parser for Commands
formulaorexpression :: OperatorState st => CharParser st EXPRESSION Source #
reduceCommand :: OperatorState st => CharParser st CMD Source #
assignment :: OperatorState st => CharParser st CMD Source #
constraint :: OperatorState st => CharParser st CMD Source #
sequenceExpr :: CharParser (AnnoState st) CMD Source #
repeatExpr :: CharParser (AnnoState st) CMD Source #
singleCase :: CharParser (AnnoState st) (EXPRESSION, [CMD]) Source #
parser spec entries
varItems :: CharParser st [VAR_ITEM] Source #
Parser for variable declarations: example: vars x,y in {1,2}; z in [-1,1]
varItem :: CharParser st VAR_ITEM Source #
Parser for a variable declaration: example: vars x,y in {1,2}
epDecl :: CharParser st (Token, EPDomain) Source #
Parser for extended parameter declarations: example: I in [1,2];
epNumValAss :: CharParser st (Token, APInt) Source #
Parser for extended parameter default values and domain variable declarations: example: I = 1; n=2
parseDomain :: CharParser st Domain Source #
parseEPVal :: CharParser st EPVal Source #
parseEPDomain :: CharParser st EPDomain Source #
basicSpec :: AParser st BASIC_SPEC Source #
Toplevel parser for basic specs
parseBasicItems :: AParser st BASIC_ITEM Source #
Parser for basic items
parseOpDecl :: AParser st BASIC_ITEM Source #
parser for operator declarations
parseVarDecl :: AParser st BASIC_ITEM Source #
parser for variable declarations
parseEPDefValOrDomDecl :: AParser st BASIC_ITEM Source #
parser for extended parameter declarations, one of: default value for an extended parameter (I=2) a domain variable declaration (n=10)
parseEPDecl :: AParser st BASIC_ITEM Source #
parser for extended parameter declarations
parseAxItems :: AParser st BASIC_ITEM Source #
parser for Axiom_item
parser for symbol maps etc.
symbMap :: GenParser Char st SYMB_OR_MAP Source #
parsing one symbol or a mapping of one to a second symbol
symbItems :: GenParser Char st SYMB_ITEMS Source #
Parse a list of comma separated symbols.
symbMapItems :: GenParser Char st SYMB_MAP_ITEMS Source #
parse a list of symbol mappings
symbMaps :: GenParser Char st ([SYMB_OR_MAP], [Token]) Source #
parse a comma separated list of symbol mappings
parseCommand :: String -> Maybe CMD Source #
parseExpression :: OperatorState a => a -> String -> Maybe EXPRESSION Source #