aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYour Name <agrawalshagun07@gmail.com>2025-07-26 00:25:27 +0530
committerYour Name <agrawalshagun07@gmail.com>2025-07-26 00:25:27 +0530
commita5105ccc4be5eb13fc87fd8554209ee03ccfc483 (patch)
tree2556b0657f292fdad33261915e0c1ee3c7fb97d9
parent444fc88251b059ef6f86d0461754cdf5c38fdccd (diff)
Adding clojure-mcp setupmain
-rw-r--r--README.md2
-rw-r--r--cljcc-compiler/src/cljcc/schema.clj30
-rw-r--r--cljcc-compiler/src/cljcc/token.clj3
-rw-r--r--deps.edn12
4 files changed, 41 insertions, 6 deletions
diff --git a/README.md b/README.md
index 0b72029..a1667a4 100644
--- a/README.md
+++ b/README.md
@@ -43,6 +43,8 @@ cli:build:native Builds native image for CLI.
To build native image, run:
+( This requires having `native-image` tool installed locally. Use the appropriate JDK distribution. )
+
``` sh
bb cli:build:native
```
diff --git a/cljcc-compiler/src/cljcc/schema.clj b/cljcc-compiler/src/cljcc/schema.clj
index bf216f9..99f1642 100644
--- a/cljcc-compiler/src/cljcc/schema.clj
+++ b/cljcc-compiler/src/cljcc/schema.clj
@@ -520,11 +520,13 @@
;;;; Assembly AST
-(def AssemblyType [:enum :longword :quadword])
+(def AssemblyType [:enum :longword :quadword :double])
(def CondCode [:enum :e :ne :g :ge :l :le :a :ae :b :be])
-(def Register [:enum :ax :dx :di :si :r8 :r9 :r10 :r11 :cx :cl :sp])
+(def Register [:enum :ax :dx :di :si :r8 :r9 :r10 :r11 :cx :cl :sp
+ :xmm0 :xmm1 :xmm2 :xmm3 :xmm4 :xmm5 :xmm6 :xmm7
+ :xmm8 :xmm9 :xmm10 :xmm11 :xmm12 :xmm13 :xmm14 :xmm15])
(def AssemblyImmOperand
[:map
@@ -653,6 +655,18 @@
[:src #'AssemblyOperand]
[:dst #'AssemblyOperand]])
+(def AssemblyCvttsd2siInstruction
+ [:map
+ [:op [:= :cvttsd2si]]
+ [:src #'AssemblyOperand]
+ [:dst #'AssemblyOperand]])
+
+(def AssemblyCvtsi2sdInstruction
+ [:map
+ [:op [:= :cvtsi2sd]]
+ [:src #'AssemblyOperand]
+ [:dst #'AssemblyOperand]])
+
(def AssemblyInstruction
[:multi {:dispatch :op}
[:mov #'AssemblyMovInstruction]
@@ -663,6 +677,8 @@
[:cmp #'AssemblyCmpInstruction]
[:idiv #'AssemblyIdivInstruction]
[:div #'AssemblyDivInstruction]
+ [:cvttsd2si #'AssemblyCvttsd2siInstruction]
+ [:cvtsi2sd #'AssemblyCvtsi2sdInstruction]
[:cdq #'AssemblyCdqInstruction]
[:jmp #'AssemblyJmpInstruction]
[:jmpcc #'AssemblyJmpCCInstruction]
@@ -672,6 +688,13 @@
[:call #'AssemblyCallInstruction]
[:ret #'AssemblyRetInstruction]])
+(def AssemblyStaticConstant
+ [:map
+ [:op [:= :static-constant]]
+ [:identifier string?]
+ [:alignment int?]
+ [:initial #'Initial]])
+
(def AssemblyStaticVariable
[:map
[:op [:= :static-variable]]
@@ -701,7 +724,8 @@
[:map
[:type [:= :obj-entry]]
[:assembly-type #'AssemblyType]
- [:static? boolean?]])
+ [:static? boolean?]
+ [:constant? {:optional true} boolean?]])
(def FunEntry
[:map
diff --git a/cljcc-compiler/src/cljcc/token.clj b/cljcc-compiler/src/cljcc/token.clj
index 213588c..f13386c 100644
--- a/cljcc-compiler/src/cljcc/token.clj
+++ b/cljcc-compiler/src/cljcc/token.clj
@@ -86,6 +86,7 @@
"Binary operands and their precedence."
{:multiply 100
:divide 100
+ :divide-double 100
:remainder 100
:plus 90
@@ -227,7 +228,7 @@
:literal literal}))
(def tacky-unary-ops
- #{:bit-not :negate :logical-not})
+ #{:bit-not :negate :logical-not :shr})
(def tacky-binary-ops
#{:add
diff --git a/deps.edn b/deps.edn
index d4a889e..2ffc8f5 100644
--- a/deps.edn
+++ b/deps.edn
@@ -8,6 +8,13 @@
{:mvn/version "0.10.3"}}
:jvm-opts ["-Dclojure.compiler.direct-linking=true"]
:ns-default build}
+ :mcp
+ {:deps {org.slf4j/slf4j-nop {:mvn/version "2.0.16"} ;; Required for stdio server
+ com.bhauman/clojure-mcp {:git/url "https://github.com/bhauman/clojure-mcp.git"
+ :git/tag "v0.1.4-alpha"
+ :git/sha "080b29b"}}
+ :exec-fn clojure-mcp.main/start-mcp-server
+ :exec-args {:port 7888}}
:storm {;; for disabling the official compiler
:extra-paths ["cljcc-compiler/src" "cli/src"]
:classpath-overrides {org.clojure/clojure nil}
@@ -20,8 +27,9 @@
:jvm-opts ["-Dclojure.storm.instrumentEnable=true"
"-Dclojure.storm.instrumentOnlyPrefixes=cljcc"]
:main-opts ["-m" "nrepl.cmdline" "--interactive" "--color" "--middleware" "[flow-storm.nrepl.middleware/wrap-flow-storm,cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]"]}
- :nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.3.0"}
+ :nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.3.1"}
cider/cider-nrepl {:mvn/version "0.50.2"}
refactor-nrepl/refactor-nrepl {:mvn/version "3.10.0"}}
:extra-paths ["cljcc-compiler/src" "cli/src"]
- :main-opts ["-m" "nrepl.cmdline" "--interactive" "--color" "--middleware" "[cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]"]}}}
+ :jvm-opts ["-Djdk.attach.allowAttachSelf"]
+ :main-opts ["-m" "nrepl.cmdline" "--interactive" "--color" "--middleware" "[cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]" "--port" "7888"]}}}