我正在阅读编程语言概念(Sebesta第10版),在文本中,它将正交性定义为“相对较小的一组原始结构可以以相对较少的方式组合以构建控制和数据语言结构“。但我对于什么使某种语言特征正交而感到困惑。因为我可能不会在其所有的荣耀中解释文本:),我在下面包含了相应的文字。
We can illustrate the use of orthogonality as a design concept by comparing
one aspect of the assembly languages of the IBM mainframe computers
and the VAX series of minicomputers. We consider a single simple situation:
adding two 32-bit integer values that reside in either memory or registers and
replacing one of the two values with the sum. The IBM mainframes have two
instructions for this purpose, which have the forms
A Reg1, memory_cell
AR Reg1, Reg2
where Reg1 and Reg2 represent registers. The semantics of these are:
Reg1 ← contents(Reg1) + contents(memory_cell)
Reg1 ← contents(Reg1) + contents(Reg2)
The VAX addition instruction for 32-bit integer values is
ADDL operand_1, operand_2
whose semantics is
operand_2 ← contents(operand_1) + contents(operand_2)
In this case, either operand can be a register or a memory cell.
The VAX instruction design is orthogonal in that a single instruction can
use either registers or memory cells as the operands. There are two ways to
specify operands, which can be combined in all possible ways. The IBM design
is not orthogonal. Only two out of four operand combinations possibilities are
legal, and the two require different instructions, A and AR.>
所以我的主要问题是为什么VAX指令是正交的。是不是因为它的构造需要较少的指令而且一切都可以在一行中完成?如果VAX系列计算机采用两条指令并且IBM采用三条指令,那么VAX语言会更正交吗?任何帮助,将不胜感激。
答案 0 :(得分:0)
好。文本不会决定它是关于orhogonal语言还是指令集。使用指令集的独特功能是可以使用(或不能使用)的寻址模式。如果您可以使用所有(或大多数)指令的所有寻址模式,则说明指令集是正交的(参见http://en.m.wikipedia.org/wiki/Orthogonal_instruction_set#section_1)。