As I was trying to build a debugger (well, a front...
# devlog-together
j
As I was trying to build a debugger (well, a frontend to lldb right now) for my language, in my language (beagle), I was getting a weird bug I couldn't figure out. So I decided to build a little compiler explorer tool for it. The left is the code, the middle is my (already register allocated) IR, and the right is the machine code. (Don't look too close, there are some bugs in how I print the machine code like
and
doesn't apply the shift). The UI is incredibly ugly, because hopefully this is the last UI I need to build for my language that isn't built in the language itself. Using the UI I was able to figure out the bug. It turns out, if I had a compilation cycle with code > 3 pages of memory, I wasn't doing the accounting properly and writing the over existing code. Ironically, the way I built this tool meant, I saw my code was right, but the code I was stepping into the debugger was wrong. So the tool showed me the bug by the absence of the bug... Now I'm continuing on to building the debugger in itself. Having a real application is helping me realize features I need and forcing me to think about what I want my language to feel like to program.
k
What does the red mean? Is it showing you which IR and machine code instructions correspond to the highlighted code in green?
j
Silly screenshot excluded my mouse. I am hovering over the green highlighted token there. And the red is IR and machine code that is produced for that part of the ast.
j
Compiler explorer is quite handy. I’ve extended it in the past as well for similar IR inspection. 🙂