Naming is hard okay. Anyway, Opd language is a bytecode compiled toy language that's not currently meant to be useful. In fact, about the only thing it does is print strings and do basic math.
The gist of it though is the debugger. Opd is bytecode compiled and bytecode interpreted, I wanted to implement a step, time-travelling debugger. The goal was to quickly get from point A to point B so I can start prototyping the debugger. The purpose is not to build or design a language, implement a good compiler or AST to bytecode translation.
Here's an example of a bytecode dump for simple.dl
go run . compile samples/simple.dl -o simple.bc -r -lnone -dRunning go run . compile -h will give you all the details you need to know
about the flags but for a quick reference regarding the above command:
-osets the output file for the compiled bytecode-rwill run the compiled bytecode-lwill set the logging level tonone, we're only interested in the program's output-dwill dump the bytecode in the format you see above for inspection
Here's an example of a debugging session for simple.dl
go run . compile samples/simple.dl -o simple.bc -r -lnone -d -s-swill start execution in the step debugger with a breakpoint on line 1 of the source code
During debugging you can always inspect the source visually to see where you are
in the execution line wise and where your breakpoints are at using source
> sourceYou can move the program counter forward or backwards using n or b.
There's one glaring limitation in the current implementation of the compiler which I alluded to in run.go is that we don't store enough of the metadata with the bytecode needed for the VM and the debugger to run straight from the bytecode.
And the things we do store we don't read back from the bytecode file. The result of that is we need to go from AST->Bytecode->VM/Debugger. Hopefully will have time to fix it in the near future, for now it serves the original purpose.
Copyright (C) 2025 hadydotai
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.

