I've completed the parser part of my MIXAL assembler. It groks all the commands, A_parts, F/I parts, W_values, LABELS etc, and passes convenient flat expressions (in MIXAL there's no precedence and grouping, exprs are flat left-to-right associative with no precedence) forward.

I've learned how to drive around P:RD's limitations (like left recursion and the greediness of (?) and (s?) quantifiers). I've learned how to use leftop: nicely, and I've learned how to handle white space - the most robust way seems to be just slapping a at the top and carefully handling it manually - this is almost essential for whitespace sensitive languages.

The grammar (~180 LOC (or should I say LOG ?)) looks "right", and has no repetitions.

One thing I haven't got a hang of yet is error reporting. As in any automated parsing, it's appalling (as an anecdotal proof of concept, I got a parse error from Perl itself reporting some totally un-connected error 500 LOC from the real error). And there's probably not much one can do about it.

This is pity, because with manual parsing I could do much better than just say "parse error on line N" (due to line oriented code, MIXAL errors at least hit the right line).

On another note, I'm still extremely excited about the Scite-scripting-with-Perl possibility I found yesterday :-) It's great great great - I just feel empowered to do anything I wish and to make my coding as efficient as possible.


comments powered by Disqus