aboutsummaryrefslogtreecommitdiff
path: root/Sil/Error.dcl
diff options
context:
space:
mode:
authorCamil Staps2017-07-27 23:32:59 +0200
committerCamil Staps2017-07-27 23:32:59 +0200
commitc23b7cd159af38f588ce4214d6ad37ceadf3c1a6 (patch)
tree66dc800514550a3729fe3e9578fb6fe00f18bfa1 /Sil/Error.dcl
parentDon't allow tuples with arity > 32 (ABC-machine limitation) (diff)
Centralise errors (needed for positional errors #5)
Diffstat (limited to 'Sil/Error.dcl')
-rw-r--r--Sil/Error.dcl28
1 files changed, 28 insertions, 0 deletions
diff --git a/Sil/Error.dcl b/Sil/Error.dcl
new file mode 100644
index 0000000..b953f60
--- /dev/null
+++ b/Sil/Error.dcl
@@ -0,0 +1,28 @@
+definition module Sil.Error
+
+from StdOverloaded import class toString
+
+from Sil.Syntax import :: Expression
+from Sil.Types import :: Type
+
+:: Error
+ // Parser errors
+ = E.a: P_Invalid String a & toString a
+ | P_Expected String
+ // Type errors
+ | T_IllegalApplication Type Type
+ | T_IllegalField String Type
+ | T_TooHighTupleArity Int
+ // Compile errors
+ | C_UndefinedName String
+ | C_UndefinedField String
+ | C_VariableLabel
+ | C_FunctionOnStack
+ | C_TypeError Error Expression
+ | C_CouldNotDeduceType Expression
+ | C_TypeMisMatch Type Expression
+ | C_BasicInitWithoutValue String
+ // Miscellaneous
+ | UnknownError String
+
+instance toString Error