BCPL八进制数字常数 [英] BCPL octal numerical constants

查看:97
本文介绍了BCPL八进制数字常数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于一直被问到使用前缀 0x表示十六进制数字的原因,我一直在研究BCPL的历史。

I've been digging into the history of BCPL due to a question I was asked about the reasoning behind using the prefix "0x" for the representation hexadecimal numbers.

在搜寻中,我偶然发现了对该令牌背后的历史的一个非常好的解释。 (为什么十六进制数字以0x为前缀?

In my search I stumbled upon a really good explanation of the history behind this token. (Why are hexadecimal numbers prefixed with 0x?)

但是,在此帖子中,又引发了另一个问题:

From this post, however, another questions sparked:

对于八进制常量,BCPL是否使用 8<位数> (根据规格: http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf )还是使用#< digit> (根据 http://rabbit.eng.miami.edu/info/bcpl_reference_manual.pdf )还是这两种语法在该语言的不同实现中均有效?

For octal constants, did BCPL use 8 <digit> (As per specs: http://cm.bell-labs.com/cm/cs/who/dmr/bcpl.pdf) or did it use #<digit> (As per http://rabbit.eng.miami.edu/info/bcpl_reference_manual.pdf) or were both of these syntaxes valid in different implementations of the language?

我还能够在这里找到第二个答案,该答案使用了#语法使我对该主题深感兴趣。 (为什么用前导零表示八进制数字?

I've also been able to find a second answer here that used the # syntax which further intrigued me in the subject. (Why are leading zeroes used to represent octal numbers?)

任何历史见解都会受到赞赏。

Any historical insights are greatly appreciated.

推荐答案

例如,虽然我们使用的是16位单元格(所以 x!y 从字地址中的 x + y 给了您16位的 word (字地址为字节的一半地址),我们还需要从 byte 地址和字节值中提取(因为我们主要是在6809字节可寻址CPU上创建操作系统和控制软件)。

For example, while the one we used had 16-bit cells (so that x!y gave you the 16-bit word from a word address at x + y (a word address being half of the byte address), we also had a need to extract from byte address and byte values (since we were primarily creating OS and control software on a 6809 byte-addressable CPU).

除以下内容外:

x!y - get word from byte address (x + y) * 2

我们也有

x!%y - get byte from byte address (x * 2) + y
x%!y - get word from byte address x + (y * 2)
x%%y - get byte from byte address x + y

我是可以肯定,它们是特定于实现的,因为我从没在其他地方看到过它们。而且BCPL早在语言标准变得像今天一样重要之前就已经存在。

I'm pretty certain they were implementation-specific as I never saw them anywhere else. And BCPL was around long before language standards were as important as they are today.

canonical 语言规范应该是Richards的较早版本。自从他写了这门语言以来(大约十年后,您的第二份文档是针对Essex BCPL实现的)。但是请记住,MAC项目是最早的迭代-之后也有了很多进步。

The canonical language specification would have been the earlier one from Richards since he wrote the language (and your second document is for the Essex BCPL implementation about a decade later). But keep in mind that Project MAC was the earliest iteration - there were plenty of advancements after that as well.

例如,2013年修订的BCPL用户指南(请参见马丁的主页),其中指定了 #b #o #x 作为各种非十进制基数的前缀。

For example, there's a 2013 revision of the BCPL User Guide (see Martin's home page) which specifies #b, #o and #x as prefixes for various non-decimal bases.

这篇关于BCPL八进制数字常数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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