A supercharged implementation of the 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 highlights which source code a given assembly block corresponds to, and vice versa. It supports more types of languages than any previous tool of it’s kind.
- Much more flexible and powerful
- Supports dissasembling to bytecode as well as assembly
- Supports many languages that godbolt does not support, such as python, common lisp, ocaml, java, and pony.
- No more sending your code to any server
- Much faster turnaround time from writing code to seeing and interacting with disassembly
- 100% usable without the mouse.
- Runs entirely without node, npm, or js.
- No required dependencies other than Emacs 25 and your compiler
:)
- It’s easy to add new languages (even those that use unique bytecode formats) without touching many files.
- Dosen’t eat your ram on the ‘server’ or the ‘client’
- No enforced limits on code size, compilation time, or processing time.
- No required dependencies other than Emacs 25 and your compiler
- Benefits from living in Emacs
- Full undo tree from Emacs on disassembly/source so you don’t loose work.
- Vim bindings through evil/viper.
- Use compile.el, flymake, or flycheck to traverse and fix errors as you would normally.
- Use any libraries on your machine trivially.
- Customize colors and behavior through
customize
. - Change tracking through magit/diff-hl/etc.
- Nyans are fully supported with nyan-mode.
- Simpler
- Infinitely hackable!
rmsbolt will almost certainly not work naively on windows as it depends on a unix shell for building the compilation commands. It may work through cygwin though.
A melpa package is available for rmsbolt.
(quelpa '(rmsbolt
:files (:defaults "starters")
:fetcher gitlab
:repo "jgkamat/rmsbolt"))
Once installed, use the rmsbolt-starter
command to generate starter files, or
enable rmsbolt-mode
in a supported language. Then run rmsbolt-compile
or
use the default C-c C-c
binding. After the first run, the buffer should
automatically update.
Language-specific quirks are listed in the demos section currently.
demangling is done with rustfilt if available
demangling is done with the compiler-explorer demangler, named
to haskell-demangler
.
Support for viewing bytecode only. Python doesn’t have many options, so most tweakables will not work. Python 3.7 is required for recursion into functions, otherwise only top level code will be shown. Python 2 is unsupported.
Parses the output of javap
, so may be a little unreliable or buggy at the
moment.
Filtering on pony is not as effective as pony asm includes references to machine-generated functions. This means the output will be slower to generate, similar to disassembly in other languages. The pony file being viewed will be copied into it’s own directory, making it much harder to view non-toy examples.
No support for source->asm matching or filtering. Only sbcl
and clisp
supported at the moment, with sbcl
giving much better results.
Adding support for a new language is fairly easy. The closer it is to existing compilers, the easier it will be (to the point where a clone of a C compiler is just a couple copy-paste lines). However, it is not excessively hard to add support for completely foreign compilers and bytecode/assembly formats.
As a minimum starting point, you must know how to compile a source file to assembly or bytecode on the command line, and know how the line numbers are available in the compiled form if they exist.
- Add a new entry to the language definitions statement.
- To do this, you will need to (at a minimum) add a mode, compile-command, a compile-cmd-function, and a starter file name.
- The compile-cmd-function is a function that will turn local variable
settings into a valid command which will take in a filename and output
assembly or an executable. See
rmsbolt--c-compile-cmd
for an example. - If the assembly is not in a standard format, you will need to define a
process-asm-custom-fn
as well (see python/java for examples).
- Add a new entry into the starter file
- For this, you will need to make a starter file. See this folder for existing examples.
You’re done!
There isn’t a dedicated place to discuss this yet, but I hang out in #emacs
on
freenode. :)
If you find issues, please send me a mail or submit an issue.
If you would like to submit a patch, please submit a merge request, or send me a mail with your patch. If your change is non-trivial, please assign copyright to the FSF as well.
Please let me know if you find other alternatives not mentioned!