想要的:术语“降低”的良好定义。在编译器的上下文中 [英] Wanted: good definition of the term "lowering" in the context of compilers

查看:100
本文介绍了想要的:术语“降低”的良好定义。在编译器的上下文中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人能在编译器的上下文中为我指出降低一词的好定义吗?

Can anyone point me to a good definition of the term "lowering" in the context of compilers?

据我所知,它是a的翻译较高级别的操作转化为较低级别操作的等效组合,但是我不确定,在Google上搜索几分钟后找不到。 (例如, GCC LLVM ,但没有引用定义。)

From what I can tell, it is the translation of a higher-level operation into an equivalent combination of lower-level operations, but I'm not really sure, and I can't find one after a few minutes of searching on Google. (There are a few usages of "lowering" e.g. in GCC or LLVM but no references to a definition.)

推荐答案

博士Dobbs刚刚发布了一篇文章由Walter Bright (在成名中),他提到了这个术语:

Dr. Dobbs just published an article by Walter Bright (of dlang fame), where he mentions the term:


降低


一个在事后看来很明显的语义技术(但是让安德烈·亚历山德斯库(Andrei Alexandrescu)指出了我的意思)被称为降低。它由内部组成,以更简单的形式重写更复杂的语义结构。例如,可以用 for while while循环和 foreach 循环。 c $ c>循环。然后,其余代码只需要处理 for 循环。事实证明,在D中实现while循环的方式中发现了一些潜在的错误,因此是一个不错的选择。它也可以根据 try-finally 语句等来重写 scope guard 语句。在每种情况下都可以

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.

这篇关于想要的:术语“降低”的良好定义。在编译器的上下文中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆