aboutsummaryrefslogtreecommitdiff
path: root/cljcc-compiler/src/cljcc/exception.cljc
diff options
context:
space:
mode:
authorYour Name <agrawalshagun07@gmail.com>2025-03-16 02:01:52 +0530
committerYour Name <agrawalshagun07@gmail.com>2025-03-16 02:01:52 +0530
commit39b6930e14cfda58fd066805f5da447c685ab67f (patch)
tree2b0f2eae0d6eb3e6c99143d67db3177534a2c1c2 /cljcc-compiler/src/cljcc/exception.cljc
parent0321df3708cfa4d1440faf3f407611df85484b4b (diff)
Rename all compiler files to cljc.
Diffstat (limited to 'cljcc-compiler/src/cljcc/exception.cljc')
-rw-r--r--cljcc-compiler/src/cljcc/exception.cljc21
1 files changed, 21 insertions, 0 deletions
diff --git a/cljcc-compiler/src/cljcc/exception.cljc b/cljcc-compiler/src/cljcc/exception.cljc
new file mode 100644
index 0000000..40ea930
--- /dev/null
+++ b/cljcc-compiler/src/cljcc/exception.cljc
@@ -0,0 +1,21 @@
+(ns cljcc.exception)
+
+(defn lex-error [{line :line col :col :as data}]
+ (throw (ex-info
+ (format "Invalid token at line: %s, col: %s." line col)
+ (merge {:error/type :lexer} data))))
+
+(defn parser-error [msg data]
+ (throw (ex-info msg (merge {:error/type :parser} data))))
+
+(defn analyzer-error [msg data]
+ (throw (ex-info msg (merge {:error/type :analyzer} data))))
+
+(defn tacky-error [msg data]
+ (throw (ex-info msg (merge {:error/type :tacky} data))))
+
+(defn compiler-error [msg data]
+ (throw (ex-info msg (merge {:error/type :compiler} data))))
+
+(defn emit-error [msg data]
+ (throw (ex-info msg (merge {:error/type :emit} data))))