From a5105ccc4be5eb13fc87fd8554209ee03ccfc483 Mon Sep 17 00:00:00 2001 From: Your Name Date: Sat, 26 Jul 2025 00:25:27 +0530 Subject: Adding clojure-mcp setup --- cljcc-compiler/src/cljcc/schema.clj | 30 +++++++++++++++++++++++++++--- cljcc-compiler/src/cljcc/token.clj | 3 ++- 2 files changed, 29 insertions(+), 4 deletions(-) (limited to 'cljcc-compiler/src/cljcc') 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 -- cgit v1.2.3