Vengineerの妄想(準備期間)

人生は短いけど、長いです。人生を楽しみましょう!

Lowering とは?


Lowering がいまいち、ピンとこないので、Google君に聞きました。

そしたら、なんか、昔見たようなページが現れたような気がしたので、記録のために残しておきますよ。

出てきたのは、Stack Overflow のこれ!


そして、回答の先には、So You Want To Write Your Own Language?

あのD言語を開発したWalter Bright氏

あたし的には、昭和の時代、大学院の時に、
世界初のNative C++ Compilerである、Zotech C++MS-DOS で使いましたわ。。。

ということで、Lowering のところは、記録のために、上記のサイトから引用します。
Lowering

  One semantic technique that is obvious in hindsight (but took Andrei Alexandrescu to point out to me)
  is called "lowering." 

  It consists of, internally, rewriting more complex semantic constructs in terms of simpler ones. 
  For example, while loops and foreach loops can be rewritten in terms of for loops. 
  Then, the rest of the code only has to deal with for loops. 
  This turned out to uncover a couple of latent bugs in how while loops were implemented in D, 
  and so was a nice win. 
  It's also used to rewrite scope guard statements in terms of try-finally statements, etc.
  Every case where this can be found in the semantic processing will be win for the implementation.

  If it turns out that there are some special-case rules in the language 
  that prevent this "lowering" rewriting, 
  it might be a good idea to go back and revisit the language design.

  Any time you can find commonality in the handling of semantic constructs, 
  it's an opportunity to reduce implementation effort and bugs.