EASM is an educational project that demonstrates the inner workings of a simple two-pass assembler.
It’s designed to help students and hobbyists learn about assembler structure, symbol resolution, and code generation using the GNU toolchain.
⚠️ Note: This project is educational and work in progress.
An assembler translates human-readable assembly language into machine code.
A two-pass assembler first scans the source to collect symbols and labels, then generates final machine code in the second pass.
EASM is not intended as a production assembler, but as an educational resource for understanding:
- How instruction parsing and tokenization work
- How symbol tables and relocations are handled
- How code is emitted after symbol resolution
- Two-pass parsing and symbol table management
- Basic instruction and directive recognition
- Minimal, clear code aimed at readability and learning
- Written in C/C++ using the GNU toolchain (
gcc,g++) - Cross-platform build system using
make - Compatible with Windows (MSYS2 / MinGW) and Linux
Clone the repository and build using GNU Make:
git clone https://github.com/herenturker/easm.git
cd easm
makeThis command will compile all source files and produce the executable:
easm.exe # On Windows
./easm # On LinuxYou will need:
- GCC (C and C++ compilers)
- GNU Make
- Optionally MSYS2 or MinGW if you are on Windows
To verify installation:
gcc --version
g++ --version
make --versionBy default, EASM reads the input assembly file and performs two passes:
- Pass 1: Scans for labels, directives, and builds the symbol table
- Pass 2: Resolves symbols and emits the final binary output
When compiled with GCC, the generated binary may depend on these runtime libraries:
| DLL | Source | License | AGPL Compatibility |
|---|---|---|---|
| libgcc_s_seh-1.dll | GCC runtime | GPL + linking exception | Yes |
| libstdc++-6.dll | GNU C++ standard library | GPL + linking exception | Yes |
| KERNEL32.dll | Windows API | System component | Yes |
| msvcrt.dll | Microsoft C runtime | System component | Yes |
These are standard system or compiler-provided libraries. They are not distributed with this repository and are automatically available on typical systems.
After compiling codes, you can run:
./easm examples/hello.asmThank you for reading.