Copyright | (c) 2002 - 2004 Wolfgang Lux 2011 - 2013 Björn Peemöller |
---|---|
License | BSD-3-clause |
Maintainer | bjp@informatik.uni-kiel.de |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe |
Language | Haskell2010 |
In order to parse infix expressions correctly, the compiler must know the precedence and fixity of each operator. Operator precedences are associated with entities and will be checked after renaming was applied. Nevertheless, we need to save precedences for ambiguous names in order to handle them correctly while computing the exported interface of a module.
If no fixity is assigned to an operator, it will be given the default precedence 9 and assumed to be a left-associative operator.
Note: this modified version uses Haskell type Integer
for representing the precedence. This change had to be done due to the
introduction of unlimited integer constants in the parser / lexer.
Synopsis
- data OpPrec = OpPrec Infix Precedence
- defaultP :: OpPrec
- defaultAssoc :: Infix
- defaultPrecedence :: Precedence
- mkPrec :: Maybe Precedence -> Precedence
- type OpPrecEnv = TopEnv PrecInfo
- data PrecInfo = PrecInfo QualIdent OpPrec
- bindP :: ModuleIdent -> Ident -> OpPrec -> OpPrecEnv -> OpPrecEnv
- lookupP :: Ident -> OpPrecEnv -> [PrecInfo]
- qualLookupP :: QualIdent -> OpPrecEnv -> [PrecInfo]
- initOpPrecEnv :: OpPrecEnv
Documentation
Operator precedence.
defaultAssoc :: Infix Source #
Default operator associativity.
defaultPrecedence :: Precedence Source #
Default operator precedence.
type OpPrecEnv = TopEnv PrecInfo Source #
Environment mapping identifiers to their operator precedence.
Precedence information for an identifier.
bindP :: ModuleIdent -> Ident -> OpPrec -> OpPrecEnv -> OpPrecEnv Source #
Bind an operator precedence.
qualLookupP :: QualIdent -> OpPrecEnv -> [PrecInfo] Source #
Lookup the operator precedence for an QualIdent
.
initOpPrecEnv :: OpPrecEnv Source #
Initial OpPrecEnv
.