The Master Key,
For Any Machine.
A highly portable assembly Intermediate Representation (IR) layer for future programming language compilers. Ditch the bloated frameworks and control the bare metal with pure Vanilla C.
.data
msg: string "Hello CommonASM\n"
.text
global _start
_start:
syscall write, stdout, msg, msg_len
syscall exit, 0
Philosophy of Carving the Bare Metal
Zero-Dependency
No need for massive, bloated frameworks like LLVM. We provide a pure AOT compiler built entirely within a single Vanilla C file (commonasmc.c).
Virtual Registers & Abstraction
Architecture dependencies are eliminated via r0~r15 virtual registers and unified syscall instructions. The compiler maps them to native registers automatically.
Self-Hosting
The ultimate goal is to build the CommonASM compiler using the CommonASM language itself. Hardcore system engineering toward a completely independent ecosystem.
Hands-on Tutorial
New to assembly? Don't worry. Follow these 3 simple steps to master a multi-architecture compiler.
Build the Compiler
Clone the repository and build the CommonASM compiler using a C compiler (gcc). With zero dependencies, it compiles in milliseconds.
git clone https://github.com/jgchoimd-web/common-assembly-language.gitcd common-assembly-languagegcc csrc/commonasmc.c -o cas_compiler
Write Your First CommonASM Code
Create a hello.cas file and paste the code below. It's a simple example that performs an addition and gracefully exits.
.text
global _start
_start:
mov r0, 10
mov r1, 20
add r0, r1
; Call Linux exit syscall
syscall exit, 0
Compile to Your Target
Now use the compiler you just built to translate hello.cas into various real assembly dialects.
./cas_compiler hello.cas --target x86_64-nasm -o hello_x86.asm
./cas_compiler hello.cas --target riscv64-gnu -o hello_rv64.s
./cas_compiler hello.cas --target mos6502 -o hello_6502.s
Insane Target Support List
From modern mainstream architectures to 8-bit retro consoles and esoteric VMs. We output to almost any environment you can imagine.
Primary / Mainstream
- x86_64-nasm
- riscv64-gnu (RV32/64/128)
- aarch64-gnu / armv7
- wasm (WebAssembly)
Retro / Classic
- mos6502 / 65816
- i8080 / z80 / ez80
- m68k / mips32
- pdp8 / pdp11 / vax
Microcontrollers
- avr / i8051
- pic16 / pic32
- xtensa / superh
- msp430
Esoteric / Virtual
- brainfuck / befunge
- fractran
- cellular-automaton
- llvm-ir / jvm-bytecode
Beginner's Guide (FAQ)
Q. Can I use it without knowing real assembly?
Yes, absolutely! CommonASM is an 'Intermediate Representation (IR)'. You don't need to memorize complex x86 instructions or unique ARM calling conventions. Just use the virtual registers r0~r15 and intuitive commands (mov, add, syscall, etc.), and the compiler will translate them into the correct native assembly for each platform.
Q. What can I actually build with this?
Suppose you want to create a brand new programming language. Writing backends to make it run on Intel, ARM, and RISC-V CPUs is a nightmare. Instead, just compile your language down to CommonASM code. Our compiler handles the rest. It's also a fantastic backbone for writing extremely lightweight, custom OS kernels without relying on bloated C standard libraries.
Q. Does it work on Windows?
Yes, it does. The CommonASM compiler core (commonasmc.c) is written entirely in standard C. As long as you have a C compiler like GCC, Clang, or MSVC installed, you can build and use it within a second on Windows, macOS, or Linux.