Karan Diwan

Assembler

A custom assembly language and Python assembler, the step from wires to words.

Once the Repeated Arithmetic Machine could execute stored instructions in raw machine code, the natural next step was a symbolic layer above it: an assembly language whose mnemonics map directly onto the machine's own hardware primitives, and a Python assembler that lexes, parses, and validates programs before translating them down to machine code.

Custom assembly language mnemonic table
Mnemonic set for asm-v0, reflecting the machine's hardware primitives directly.

Versions built

Syntax analysis output
Syntax analysis, asm-v0.3.
Semantic analysis output
Semantic analysis, asm-v0.3.

Syntax analysis catches malformed programs before they reach the assembler, saving computation on programs that would fail anyway. Semantic analysis goes a step further, catching logical flaws, like referencing an undefined address, that are syntactically valid but would fail on the real machine.

Stack: Python, syntax and semantic analysis
View repository on GitHub →
← Repeated Arithmetic Machine Next: Artificial Neuron →