tiger-1.1: src/TigerError.ag
MODULE {TigerError} {} {}
{
import TigerTypes
import UU.Scanner.Position
}
DATA Error
| UndeclaredVar Ident
| UndeclaredType Ident
| DuplicateType Ident pos2:Pos
| DuplicateFun Ident pos2:Pos
| DuplicateArg fun:Ident Ident pos2:Pos
| DupRecordFieldDecl Ident pos2:Pos
| CyclicType Ident
| UnknownType pos:Pos
| NotVarType Ident
| UndeclaredFun Ident
| NotFunType Ident
| NotArrayType pos:Pos
| NotRecordType pos:Pos
| NoSuchField pos:Pos field:Ident
| TypeMisMatch expect:{TYPE} tp:{TYPE}
| TooManyArguments fun:Ident
| TooFewArguments fun:Ident
| FieldNotInit field:Ident
| CompareOp pos:Pos op:String
| AssignLoopcounter pos:Pos
| InitWithVoid pos:Pos
ATTR Error [ || msg:String ]
SEM Error
| UndeclaredVar lhs.msg = "undeclared variable: " ++ show @ident
| UndeclaredType lhs.msg = "undeclared type: " ++ show @ident
| DuplicateType lhs.msg = "duplicate type declaration: " ++ show @ident ++ " other occurrence at: " ++ show @pos2
| DuplicateFun lhs.msg = "duplicate function declaration: " ++ show @ident ++ " other occurrence at: " ++ show @pos2
| DuplicateArg lhs.msg = "duplicate formal argument declaration: " ++ show @ident ++ " other occurrence at: " ++ show @pos2
| DupRecordFieldDecl lhs.msg = "duplicate record field declaration: " ++ show @ident ++ " other occurrence at: " ++ show @pos2
| CyclicType lhs.msg = "cyclic type synonym: " ++ show @ident
| UnknownType lhs.msg = "unable to determine type for expression at: " ++ show @pos
| NotVarType lhs.msg = "identifier: " ++ show @ident ++ " is not a variable"
| UndeclaredFun lhs.msg = "undeclared function: " ++ show @ident
| NotFunType lhs.msg = "identifier: " ++ show @ident ++ " is not a function"
| NotArrayType lhs.msg = "at: " ++ show @pos ++ " subscript of non-array type"
| NotRecordType lhs.msg = "at: " ++ show @pos ++ " field selection of non-record type"
| NoSuchField lhs.msg = "at: " ++ show @pos ++ " record type does not have a field named: " ++ showField @field
| TypeMisMatch lhs.msg = "type: " ++ show @tp ++ " does not match: " ++ show @expect
| TooManyArguments lhs.msg = "too many arguments for: " ++ show @fun
| TooFewArguments lhs.msg = "not enough arguments for: " ++ show @fun
| FieldNotInit lhs.msg = "field not initialized: " ++ showField @field
| CompareOp lhs.msg = "at: " ++ show @pos ++ ":" ++ " operator " ++ show @op ++ " only defined for int and string"
| AssignLoopcounter lhs.msg = "at: " ++ show @pos ++ ":" ++ "cannot assign to loop variable"
| InitWithVoid lhs.msg = "at: " ++ show @pos ++ ":" ++ "cannot initialize with no value"
{
showField ident = show (getName ident)
}