diff options
| author | Shagun Agrawal <agrawalshagun07@gmail.com> | 2024-12-02 20:58:31 +0530 |
|---|---|---|
| committer | Shagun Agrawal <agrawalshagun07@gmail.com> | 2024-12-02 20:58:31 +0530 |
| commit | fa049cc22c6c7b64b51e6e10b33a259fa58945d7 (patch) | |
| tree | 20806700ac0e751fa154df249be0ee87cbb4bb76 /src/cljcc/tacky.clj | |
| parent | 70314ca6f691ea1f547f09d3044a7f2b2a684289 (diff) | |
Refactor schema to separate file
Diffstat (limited to 'src/cljcc/tacky.clj')
| -rw-r--r-- | src/cljcc/tacky.clj | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cljcc/tacky.clj b/src/cljcc/tacky.clj index 58026fd..b19dacd 100644 --- a/src/cljcc/tacky.clj +++ b/src/cljcc/tacky.clj @@ -3,6 +3,7 @@ [cljcc.lexer :as l] [cljcc.util :as u] [cljcc.parser :as p] + [cljcc.exception :as exc] [cljcc.analyze.core :as a])) (defn- variable @@ -31,7 +32,7 @@ :complement :bit-not :hyphen :negate :logical-not :logical-not - (throw (ex-info "Tacky Error. Invalid unary operator." {op op})))) + (exc/tacky-error "Invalid unary operator." {op op}))) (defn- assignment-operator->binary-operator "Converts parser assignment operator to binary operator keyword." @@ -384,11 +385,12 @@ :global?])) (assoc :instructions instructions)))) -(defn- tacky-static-variable [identifier global? initial-value] +(defn- tacky-static-variable [identifier global? variable-type initial-value] {:identifier identifier :global? global? :initial-value initial-value :type :declaration + :variable-type variable-type :declaration-type :static-variable}) (defn- tacky-static-variable-instructions [ident->symbols] |
