C to Assembly is an online compiler of micro-C code (a subset of C large enough for demonstration) and interpreter of hypothetical Assembly (micro-C is compiled to hypothetical Assembly which looks a lot like x86 asm).
See docs here:
src/main/java/com/ctoassembly/compiler
- Java compiler (micro-C to hypothetical-asm)- Yeah, yeah, yeah, I am not joking - Java is compiling c to asm.
mycc.lex
- scanner written in Backus-Naur form.mycc.cup
- LR parser that defines the grammar. All the code generation is executed from here (when a rule is matched), so it's a good starting point for reading code.
WebContent
- JavaScript/Angular assembly interpreterccode.html
- compiling happens here.js/angular/controller.js
- angular controller backing up the ccode.html. It calls the servlet holding the compiler, presents the asm code and interprets (executes) it line by line.js/cpu.js
- that's the javascript CPUjs/asmmetamodel.js
- all asm instructions and their execution strategy is encapsulated herejs/ui.js
- ui support (drawing and such)js/constants.js
- CPU constantsjs/util.js
- util support for everything abovejs/prototype.js
- useful javascript extensions that I used throughout the code
- Enlarge the subset of C that the compiler can compile
- Fix bugs
Apache 2.0
Free Software, Hell Yeah!