GithubHelp home page GithubHelp logo

unshorn / rmsbolt Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rurban/rmsbolt

0.0 1.0 0.0 147 KB

pony mode WIP

Home Page: https://gitlab.com/jgkamat/rmsbolt

License: GNU Affero General Public License v3.0

Emacs Lisp 57.22% Java 0.39% C 0.33% C++ 0.34% Haskell 0.65% Common Lisp 0.37% OCaml 0.28% Python 0.18% Rust 0.34% Assembly 39.48% Pony 0.41%

rmsbolt's Introduction

RMSbolt

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.

Why RMSbolt over godbolt?

  • 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.
  • 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!

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

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.

Demos

C/C++

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

OCaml

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

Rust

demangling is done with rustfilt if available

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

Haskell

demangling is done with the compiler-explorer demangler, named to haskell-demangler.

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

Python

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.

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

Java

Parses the output of javap, so may be a little unreliable or buggy at the moment.

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

Pony

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.

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

Common Lisp

No support for source->asm matching or filtering. Only sbcl and clisp supported at the moment, with sbcl giving much better results.

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

Adding a Language

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.

  1. 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).
  2. 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!

Community and Support

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.

Alternatives

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

rmsbolt's People

Contributors

jgkamat avatar rurban avatar monnier avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.