[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/beardbolt 3ca3f35cdb 050/323: Add very basic support fo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/beardbolt 3ca3f35cdb 050/323: Add very basic support for rust |
Date: |
Thu, 9 Mar 2023 10:58:02 -0500 (EST) |
branch: externals/beardbolt
commit 3ca3f35cdb14a27eaef9f58db1bbb0fb508cc649
Author: Jay Kamat <jaygkamat@gmail.com>
Commit: Jay Kamat <jaygkamat@gmail.com>
Add very basic support for rust
---
README.org | 2 +-
rmsbolt.el | 37 +++++++++++++++++++++++++++++++------
starters/rmsbolt.c | 2 +-
starters/rmsbolt.cpp | 2 +-
starters/rmsbolt.ml | 2 +-
starters/rmsbolt.rs | 35 +++++++++++++++++++++++++++++++++++
6 files changed, 70 insertions(+), 10 deletions(-)
diff --git a/README.org b/README.org
index 85395517ef..2a9207b33f 100644
--- a/README.org
+++ b/README.org
@@ -1,7 +1,7 @@
* RMSbolt
-A basic implementation of the
[[https://github.com/mattgodbolt/compiler-explorer][godbolt compiler-exporter]]
for Emacs.
+A basic implementation of the
[[https://github.com/mattgodbolt/compiler-explorer][godbolt compiler-explorer]]
for Emacs.
RMSBolt tries to make it easy to see what your compiler is doing. It does this
by showing you the assembly output of a given source code file. It also
diff --git a/rmsbolt.el b/rmsbolt.el
index 0de2ad2637..2e5ed91bd5 100644
--- a/rmsbolt.el
+++ b/rmsbolt.el
@@ -1,11 +1,11 @@
-;;; rmsbolt.el --- A compiler output viewer for Emacs -*- lexical-binding: t;
-*-
+;;; rmsbolt.el --- A compiler output viewer -*- lexical-binding: t; -*-
;; Copyright (C) 2018 Jay Kamat
;; Author: Jay Kamat <jaygkamat@gmail.com>
-;; Version: 0.0.1
-;; Keywords: compilation
+;; Version: 0.1.0
+;; Keywords: compilation, tools
;; URL: http://gitlab.com/jgkamat/rmsbolt
-;; Package-Requires: ((emacs "25.0"))
+;; Package-Requires: ((emacs "25.1"))
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU Affero General Public License as published by
@@ -300,6 +300,22 @@ Assumes function name to dissasemble is 'main'."
" "))
(_
(error "This Common Lisp interpreter is not supported")))))
+(cl-defun rmsbolt--rust-compile-cmd (&key src-buffer)
+ "Process a compile command for rustc."
+ (let* ((cmd (buffer-local-value 'rmsbolt-command src-buffer))
+ (cmd (mapconcat 'identity
+ (list cmd
+ "-g"
+ "--emit"
+ (if (buffer-local-value 'rmsbolt-disassemble
src-buffer)
+ "link"
+ "asm")
+ (buffer-file-name)
+ "-o" (rmsbolt-output-filename src-buffer)
+ (when (buffer-local-value 'rmsbolt-intel-x86
src-buffer)
+ "-Cllvm-args=--x86-asm-syntax=intel"))
+ " ")))
+ cmd))
(defvar rmsbolt--hidden-func-c
(rx bol (or (and "__" (0+ any))
@@ -364,6 +380,15 @@ Assumes function name to dissasemble is 'main'."
:starter-file-name "rmsbolt.lisp"
:compile-cmd-function #'rmsbolt--lisp-compile-cmd
:disass-hidden-funcs nil))
+ (rust-mode
+ . ,(make-rmsbolt-lang :mode 'rust-mode
+ :compile-cmd "rustc"
+ :supports-asm t
+ :supports-disass nil
+ :objdumper 'objdump
+ :starter-file-name "rmsbolt.rs"
+ :compile-cmd-function #'rmsbolt--rust-compile-cmd
+ :disass-hidden-funcs nil))
))
;;;; Macros
@@ -379,7 +404,7 @@ Assumes function name to dissasemble is 'main'."
;;;; Functions
-;; Functions to parse and lint assembly were lifted almost directly from the
compiler-exporter
+;; Functions to parse and lint assembly were lifted almost directly from the
compiler-explorer
(defun rmsbolt-re-seq (regexp string)
"Get list of all REGEXP match in STRING."
@@ -393,7 +418,7 @@ Assumes function name to dissasemble is 'main'."
;;;;; Filter Functions
-;; Filtering functions were more or less lifted from the godbolt compiler
exporter to maintain compatiblity.
+;; Filtering functions were more or less lifted from the godbolt compiler
explorer to maintain compatiblity.
;; https://github.com/mattgodbolt/compiler-explorer/blob/master/lib/asm.js
(defun rmsbolt--has-opcode-p (line)
diff --git a/starters/rmsbolt.c b/starters/rmsbolt.c
index 63dc6d69cc..65103434ba 100644
--- a/starters/rmsbolt.c
+++ b/starters/rmsbolt.c
@@ -4,7 +4,7 @@
// Local Variables:
// rmsbolt-command: "gcc -O0"
-// rmsbolt-dissasemble: nil
+// rmsbolt-disassemble: nil
// End:
int isRMS(int a) {
diff --git a/starters/rmsbolt.cpp b/starters/rmsbolt.cpp
index aa4dee0f0e..40cc5a94b2 100644
--- a/starters/rmsbolt.cpp
+++ b/starters/rmsbolt.cpp
@@ -4,7 +4,7 @@
// Local Variables:
// rmsbolt-command: "g++ -O0"
-// rmsbolt-dissasemble: nil
+// rmsbolt-disassemble: nil
// End:
int isRMS(int a) {
diff --git a/starters/rmsbolt.ml b/starters/rmsbolt.ml
index 23872d40de..4cb5fe07db 100644
--- a/starters/rmsbolt.ml
+++ b/starters/rmsbolt.ml
@@ -5,7 +5,7 @@
(*
Local Variables:
rmsbolt-command: "ocamlopt"
-rmsbolt-dissasemble: nil
+rmsbolt-disassemble: nil
End:
*)
diff --git a/starters/rmsbolt.rs b/starters/rmsbolt.rs
new file mode 100644
index 0000000000..80e90ed5b5
--- /dev/null
+++ b/starters/rmsbolt.rs
@@ -0,0 +1,35 @@
+// rust rmsbolt starter file
+
+// Local Variables:
+// rmsbolt-command: "rustc -C opt-level=0"
+// rmsbolt-disassemble: nil
+// End:
+
+
+fn main() {
+ let number = 13;
+ // TODO ^ Try different values for `number`
+
+ println!("Tell me about {}", number);
+ match number {
+ // Match a single value
+ 1 => println!("One!"),
+ // Match several values
+ 2 | 3 | 5 | 7 | 11 => println!("This is a prime"),
+ // Match an inclusive range
+ 13...19 => println!("A teen"),
+ // Handle the rest of cases
+ _ => println!("Ain't special"),
+ }
+
+ let boolean = true;
+ // Match is an expression too
+ let binary = match boolean {
+ // The arms of a match must cover all the possible values
+ false => 0,
+ true => 1,
+ // TODO ^ Try commenting out one of these arms
+ };
+
+ println!("{} -> {}", boolean, binary);
+}
- [elpa] externals/beardbolt e6081fae6b 032/323: Add unrefined support for ocaml, (continued)
- [elpa] externals/beardbolt e6081fae6b 032/323: Add unrefined support for ocaml, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a638324882 039/323: Add OCaml demo, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt e0d917206e 038/323: Improve quality of default matching faces, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt a950515dfc 043/323: Fix spelling mistake, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 4213316f23 037/323: Fix recentering when not needed, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 545a366472 049/323: Add more tests, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 2e6163c95a 047/323: Add testing framework, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 5efa347027 046/323: Update readme, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 082cbc7b1c 048/323: Add new tests, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt ff6f376d87 053/323: Update README.org, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt 3ca3f35cdb 050/323: Add very basic support for rust,
ELPA Syncer <=
- [elpa] externals/beardbolt 65a1ac7b6e 054/323: Add support for demangling, ELPA Syncer, 2023/03/09
- [elpa] externals/beardbolt bb64352f8d 034/323: Store and use ranges to view highlighted regions, ELPA Syncer, 2023/03/09
- [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