← Back to context

Comment by hoten

1 month ago

Implementing a debugger for the custom scripting language used by the Zelda game engine I contribute to.

The game engine I work on (link in bio) developed a custom language for engine customization, but it never had any runtime debugging capabilities. I've been adding that over the last couple weeks.

The language compiles to a bytecode, which is what the engine runs. But the bytecode has no source information.

The easy part was getting source locations for stack traces (associating each generated bytecode with an originating source line of code).

Harder was getting scopes information for displaying function names in those stack frames, and for associating runtime variables per-scope (stack variables, globals, class fields, etc.)

Now I just need to create an expression parser for evaluating expressions at runtime based on the current scope, add breakpoints and step over/into/etc. capability to the engine, then wrap it all together in a VSCode extension.

https://web.zquestclassic.com/zscript/ (this doesn't show what I'm working on, it's just a basic web text editor to quickly test the language. can't run it from here).