AlexAltea / unicorn.js

Unicorn CPU emulator framework port for JavaScript
https://alexaltea.github.io/unicorn.js/
GNU General Public License v2.0
573 stars 37 forks source link

Feature Request: Hook #14

Closed rljacobson closed 5 years ago

rljacobson commented 5 years ago

Hook into the Godbolt API to allow compilation of C/C++ to assembly and the execution of that assembly in the Unicorn.js library.

This feature request is inspired by https://github.com/vasyop/miniC-hosting, an in-browser C interpreter and assumbler to MSIL that visualizes machine state for educational putposes.

AlexAltea commented 5 years ago

This is a great idea, and would love to see it in action! However, this feels a bit out-of-scope here:

Unicorn is an emulation library and Unicorn.js is simply a port of that library to JavaScript via Emscripten. Anything that is not present in Unicorn, other than minor wrappers and syntactic sugar, should probably not be shipped alongside Unicorn.js. Consequently I wouldn't call this a "feature request".

Of course, we could create a demo for Unicorn.js that showcases your idea, but honestly the current demo feels "good enough" at showing the usage of the API. Instead, you could either:

  1. Submit this feature request to Godbolt's compiler-explorer issue tracker: https://github.com/mattgodbolt/compiler-explorer/issues
  2. Create a Unicorn.js-based tool that implements your idea in its own standalone repository.

As an brief example of other tools that have been built on top of Unicorn.js you can find: https://micropython.org/unicorn/ (sources are also available). I hope that serves as inspiration. :-)

rljacobson commented 5 years ago

Yeah, I agree on all points. Unfortunately, all of my extra brain cycles have been committed to other things. The Godbolt people have bigger fish to fry, and I suspect that they would see it as out of scope as well.

Well, now who's going to do it? :)