Anyway, debugging recursive descent compilers is hard, because they're declarative in nature. This is actually going to end up being a key insight (no, not hexapodia) - debugging an imperative program is far, far easier than debugging a declarative one, because you can step through what the program is doing. In a declarative program, not only do you not know when or where things are being done, it's exceptionally difficult to interpose a check point.
I wrote a small debug atom for parsers, though - when it's invoked, it always succeeds, consuming nothing, just like \¬hing - but it prints a message.
Using it felt like ... Prolog.
No comments:
Post a Comment