Grok
Fun with compilers, interpereters, and such.
Language
Grok is a few things:
- A simple language. Integer, plus or minus, then integer.
- An interpreter/emulator. Kinda looks like a made-up CPU.
- The assembly/bytecode for that CPU.
Commands
rungrok: take a grok program and run itgrokc: take a grok program and spit out assembly/bytecodegrok: take assembly/bytecode and execute itgrokdb: take assembly/bytecode and step through like a debugger
Instructions
grok is a machine with three registers, a, b, and c. There’s also a
program counter, pc, that you can just observe, not do anything with. Yet.
Instructions:
set reg val: set the registerregto the valuevalset reg1 reg2: set the registerreg1to the value ofreg2increment reg: increment the registerregdecrement reg: decrement the registerreg
That’s it, for now.