r/Compilers • • Aug 01 '26

Any debugging advice / tools for compilers?

Tired of print statements everywhere. It very satisfactory to see one but I would much rather have something like lldb to easily debug the code more intuitively.

Are there any other useful tools?

16 Upvotes

15 comments sorted by

View all comments

Show parent comment

1

u/FirmSupermarket6933 Aug 02 '26

Not the OP, but could you recommend way to unit test intermediate states? Because it's a bit annoying to construct AST by hand, e.g. for "x + y" to write "BinaryExpr(BIN_ADD, Variable("x"), Variable("y")". It even worse for more complicated expressions or for small programs.

1

u/vmcrash Aug 02 '26

You may create some helper methods like add(var("x"), var("y")).