/rmsbolt

A compiler output viewer

Primary LanguageEmacs LispGNU Affero General Public License v3.0AGPL-3.0

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 its kind.

This README is a condensed version of the docs. For full usage instructions, please start at the docs (also available through info).

Why RMSbolt over godbolt?

  • Much more flexible and powerful:
    • Supports disassembly to bytecode as well as assembly.
    • Supports many languages that godbolt does not support, such as PHP,
    • Common Lisp, Emacs Lisp, and Pony.
    • Allows targeting custom compilers - which means disassembly for niche assembly targets, specific commits of compilers, and patched libraries or compilers is possible.
  • 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.
    • Doesn’t eat your ram on the ‘server’ or the ‘client’.
    • No enforced limits on code size, compilation time, or processing time.
  • Benefits from living in Emacs:
    • Full undo tree from Emacs on disassembly/source so you don’t lose 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!

Installation

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.

Melpa

A melpa package is available for rmsbolt.

Quelpa

(quelpa '(rmsbolt
          :files (:defaults "starters")
          :fetcher gitlab
          :repo "jgkamat/rmsbolt"))

Running

Run rmsbolt to compile the current buffer. This enables rmsbolt-mode for code region highlighting and automatic recompilation on buffer changes.

rmsbolt-mode also adds the key binding C-c C-c to run a compilation.

Run rmsbolt-starter to generate an example source file for one of the supported languages.

Run rmsbolt-compile to start a compilation without enabling rmsbolt-mode.

Language-specific quirks are listed in the full documentation.

Configuration

RMSbolt is primarily configured with Emacs local variables. This lets you change compiler and rmsbolt options simply by editing a local variable block. The starter files have this block with some common settings:

// Local Variables:
// rmsbolt-command: "gcc -O0"
// rmsbolt-disassemble: nil
// End:

Note: the Local Variable block must be 3000 characters from the end of the file to work. Any method of setting buffer-local variables will work though.

The main knobs are described in the full documentation.

Demos

C/C++

https://i.imgur.com/Rox6y0U.gif

OCaml

https://i.imgur.com/369Ylxk.gif

Rust

https://i.imgur.com/nW1lVFM.gif

Haskell

https://i.imgur.com/fAQQMJe.gif

Python

https://i.imgur.com/cMYfkGx.gif

Java

https://i.imgur.com/KkWEMMj.gif

Go

https://gitlab.com/jgkamat/rmsbolt/uploads/4ca143ac99f33880dbde000d71ff3763/rmsbolt-go-2.gif

PHP

https://i.imgur.com/xBfzaK9.gif

Pony

https://i.imgur.com/8kd6kkJ.gif

D

https://i.imgur.com/BkMse7R.gif

Emacs Lisp

https://i.imgur.com/uYrQ7En.gif

Common Lisp

https://i.imgur.com/36aNVvf.gif

Swift

https://gitlab.com/jgkamat/rmsbolt/uploads/80d38e840a149c77951891c3623ca2f2/lFG72Lv_-_Imgur.gif

Nim

https://i.imgur.com/8y4jtK9.gif

Community and Support

If you need help, have questions, or just want to chat about compilers, feel free to drop by #rmsbolt on Libera. Please be sure to stick around, for a reply.

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.

Alternatives

Please let me know if you find other alternatives not mentioned!