《Programming from the Ground Up》阅读笔记:p181-p216

《Programming from the Ground Up》学习第10天,p181-p216总结,总计34页。

一、技术总结

第10章主要讲计算机是如何计算的,如十进制、二进制、八进制、十六进制以及浮点数和负数的表示。属于比较基础的内容,如果有一定基础,本章可跳过。

1.exponent & mantissa

示例:p197, 12345.2 is stored as 1.23452 * 10^4. The mantissa is 1.23452 and the exponent is 4.

2.compiled and interpreted language

(1)compiled language

p231, Many languages are compiled languages. When you write assembly language,each instruction you write is translated into exactly one machine instruction for processing. With compilers, a statement can translate into one or hundreds of machine instructions.

很多语言属于编译型语言。当使用汇编语言(assembly language)编程时,每一条指令会被转换成一条机器执行进行处理。使用编译器(compiler),一条语句(statement)可以被转换成一条或者多条机器指令。

(2)interpreted language

p214, There are also languages that are interpreted languages. These languages require

that the user run a program called an interpreter that in turn runs the given program.

也有很多语言属于解释型语言。解释型语言要求用户运行称为解释器(interpreter)的的程序来执行指定的程序。

(3)hybrid language(compiled and interpreted language)

There is also a class of hybrid languages which partially compile a program before execution into byte-codes.

还有一类混合语言,程序在执行前会被部分编译(partially compile,这里暂时想不出什么好的翻译,将就理解吧)成字节码。

总结:什么样的语言称为编译型语言(compiled language),什么的语言称为解释型语(interpreted language)?其实作者并没有给出很明确的定义,引用维基百科里面的一段话来概括吧:The term is vague since, in principle, any language can be compiled or interpreted and in practice some languages are both (in different environments).In some environments, source code is first compiled (to an intermediate form; often bytecode) and then interpreted(这个术语是模糊的,因为原则上,任何语言都可以被编译或解释,在实践中,有些语言两者都可以(在不同的环境中)。在某些环境中,源代码首先被编译成一种中间形式(通常是字节码),然后再进行解释。

为了改善编译语言的效率而发展出的即时编译技术,已经缩小了这两种语言间的差距。这种技术混合了编译语言与解释型语言的优点,它像编译语言一样,先把程序源代码编译成字节码。到执行期时,再将字节码直译,之后执行。Java就是这种技术的代表产物。

以前自己对这两个概念很纠结,到底怎么区分?看完维基百科的这段话后觉得很有道理,个人理解就是看语言的行为,一门语言既可以是解释性语言,也可以是编译型语言,也可以是两者的结合(如:JAVA)。

二、英语总结

1.hallway vs hall

p187, We have a switch for outside lights, a switch for the hallway lights, a switch for the living room lights, and a switch for the bedroom lights.

hallway和hall的意思差不多,都是指"a passage in a house(走廊)", 它们之间的一个微小差别是:hallway implies "narrow passage", hall implies “large space or room”。

2.flinch at

flinch: make a sudden small movement of pain or fear(这是物理意义上的),也可以用于比喻意义(退缩)。

示例:p213, Languages are simply tools, and learning to use a new tool should not be something a programmer flinches at.

3.negligible

p214, However, in well-made interpreters, this time can be fairly negligible.

(1)negligible: negligence + -ible。

(2)negligence: neglect。

(3) neglect: *ne-("not") + *leg-("to collect, gather").vt. to not give enough care or attention to sth(忽视)。

三、其它

今日没有什么想说的。

四、参考资料

1. 编程

(1)Jonathan Bartlett,《Programming From The Ground Up》:https://book.douban.com/subject/1787855/

2. 英语

(1)Etymology Dictionary:https://www.etymonline.com

(2) Cambridge Dictionary:https://dictionary.cambridge.org

欢迎搜索及关注:编程人(a_codists)

posted @ 2024-10-09 22:41  codists  阅读(8)  评论(0编辑  收藏  举报