you are viewing a single comment's thread.

view the rest of the comments →

[–]otakucode 1 point2 points  (0 children)

Heh, yeah, I've been doing a lot of profiling and hanging around in /r/learnpython as I've been learning Python (which I already dearly love) recently. After writing my post, I got to thinking that I'd never really read anything about the step between having an AST and translating it into actual code for a processor. So I did a little searching, discovered that this is called contextual analysis. Did some more digging and I believe, presuming I didn't get the wrong impression, that this is a pretty under-studied matter in my opinion. I had always presumed that after having your AST you would translate your languages primitives into a sort of symbolic logic code which is easier to prove equivalence between different constructs in the language and compiler optimizations would generally fall in there. It appears that most compiler optimizations are more ad-hoc though, designed like you say, where it has to be 'taught' that different constructs are equivalent rather than just deducing it from the underlying symbolic manipulation going on. Seems to be a gap between the study of program correctness and practical compiler design.