[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt a0527f16af 045/323: Add very basic support fo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt a0527f16af 045/323: Add very basic support for common lisp |
Date: |
Thu, 9 Mar 2023 10:58:01 -0500 (EST) |
branch: externals/beardbolt
commit a0527f16afbfbb59b28e32d4efdc8ef709f927fe
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add very basic support for common lisp
---
rmsbolt.el | 49 ++++++++++++++++++++++++++++++++++++++++++++++++-
starters/rmsbolt.lisp | 16 ++++++++++++++++
2 files changed, 64 insertions(+), 1 deletion(-)
diff --git a/rmsbolt.el b/rmsbolt.el
index 6ed6cd4b39..0de2ad2637 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -273,6 +273,34 @@ Needed as ocaml cannot output asm to a non-hardcoded file"
" "))
" ")))
cmd))
+(cl-defun rmsbolt--lisp-compile-cmd (&key src-buffer)
+ "Process a compile command for common lisp.
+
+Assumes function name to dissasemble is 'main'."
+ (let* ((cmd (buffer-local-value 'rmsbolt-command src-buffer))
+ (interpreter (cl-first (split-string cmd nil t)))
+ (disass-eval "\"(disassemble 'main)\"")
+ (disass-eval-unquoted "(disassemble 'main)"))
+ (pcase interpreter
+ ("sbcl"
+ (mapconcat 'identity
+ (list cmd "--noinform" "--load"
+ (buffer-file-name)
+ "--eval" disass-eval "--non-interactive"
+ ;; Remove leading comments
+ "|" "sed" "'s/^;\s//'" ">"
+ (rmsbolt-output-filename src-buffer))
+ " "))
+ ("clisp"
+ (mapconcat 'identity
+ (list cmd "-q" "-x"
+ (concat
+ "\"(load \\\"" (buffer-file-name) "\\\") "
disass-eval-unquoted "\"")
+ ">" (rmsbolt-output-filename src-buffer))
+ " "))
+ (_
+ (error "This Common Lisp interpreter is not supported")))))
+
(defvar rmsbolt--hidden-func-c
(rx bol (or (and "__" (0+ any))
(and "_" (or "init" "start" "fini"))
@@ -326,7 +354,17 @@ Needed as ocaml cannot output asm to a non-hardcoded file"
:supports-disass t
:starter-file-name "rmsbolt.ml"
:compile-cmd-function #'rmsbolt--ocaml-compile-cmd
- :disass-hidden-funcs rmsbolt--hidden-func-ocaml))))
+ :disass-hidden-funcs rmsbolt--hidden-func-ocaml))
+ (lisp-mode
+ . ,(make-rmsbolt-lang :mode 'lisp-mode ;; Assume common lisp..
+ :compile-cmd "sbcl"
+ :supports-asm t
+ :supports-disass nil
+ :objdumper 'cat
+ :starter-file-name "rmsbolt.lisp"
+ :compile-cmd-function #'rmsbolt--lisp-compile-cmd
+ :disass-hidden-funcs nil))
+ ))
;;;; Macros
@@ -648,6 +686,14 @@ Needed as ocaml cannot output asm to a non-hardcoded file"
"att")
">" (rmsbolt-output-filename src-buffer t))
" ")))
+ ('cat
+ (setq cmd
+ (mapconcat 'identity
+ (list cmd
+ "&&" "mv"
+ (rmsbolt-output-filename src-buffer)
+ (rmsbolt-output-filename src-buffer t))
+ " ")))
(_
(error "Objdumper not recognized"))))
(setq-local rmsbolt-src-buffer src-buffer)
@@ -709,6 +755,7 @@ Needed as ocaml cannot output asm to a non-hardcoded file"
(rmsbolt-defstarter "c" 'c-mode)
(rmsbolt-defstarter "c++" 'c++-mode)
(rmsbolt-defstarter "ocaml" 'tuareg-mode)
+(rmsbolt-defstarter "cl" 'lisp-mode)
;;;; Font lock matcher
(defun rmsbolt--goto-line (line)
diff --git a/starters/rmsbolt.lisp b/starters/rmsbolt.lisp
new file mode 100644
index 0000000000..af964082e0
--- /dev/null
+++ b/starters/rmsbolt.lisp
@@ -0,0 +1,16 @@
+;; Common Lisp rmsbolt starter file
+
+;; rmsbolt ONLY DISASSEMBLES THE MAIN FUNCTION.
+;; Please ensure you have a main function defined,
+;; and place all your code inside of it!
+
+;; Local Variables:
+;; rmsbolt-command: "sbcl"
+;; End:
+
+(defun main ()
+ (defun add (a b)
+ ;; (declare (optimize (speed 3) (safety 0) (debug 0)))
+ ;; (declare (type fixnum a b))
+ (+ a b))
+ (add 2 3))
- [elpa] externals/beardbolt 1419a90465 040/323: Add C/C++ demo, (continued)
- [elpa] externals/beardbolt 1419a90465 040/323: Add C/C++ demo, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 39f1e05667 009/323: Add filter for commentOnly, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4a35528d7d 021/323: Configure all variables with buffer-local values, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3bfc7ed2e3 012/323: Allow custom functions to parse arguments, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 98cea6e8e0 023/323: Simplify creation of new starters with a macro, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 547a47e58f 022/323: Fix default commands, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2530003c71 020/323: Remove rmsbolt-options, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt cf7d2787bc 027/323: Implement line number parsing, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 8fc36eacd8 044/323: Add option to force assembling, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt d37f8a0ebf 042/323: Remove reliance on hl-line-mode, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a0527f16af 045/323: Add very basic support for common lisp,
ELPA Syncer <=
- [elpa] externals/beardbolt d7acfdd127 041/323: Fix rmsbolt temp directory generation being too late, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt f0d13c4ac2 036/323: Add a stronger blacklist for ocaml asm, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 22810d69a7 062/323: Add docs for python, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 503b51ecb8 066/323: Fix typo, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ca92d533ad 061/323: Add basic support for python, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt fef52d3de3 057/323: Update readme, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 1f50b7bb7f 069/323: Add java framework, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 0e0d82d774 056/323: Override default directory to prevent rouge executables, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 7e4baa833e 068/323: Fix a few comments, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 234e09b81a 065/323: Fix spelling of OCaml, ELPA Syncer, 2023/03/09