fbpx
维基百科

B語言

B語言是一种通用的程序设计语言。自從被C語言取代之後,它幾乎已遭棄置。

B语言
設計者肯·汤普森
實作者肯·汤普森丹尼斯·利奇
发行时间1969年,​54年前​(1969[1]
型態系統无类型(所有东西都是
文件扩展名.b
啟發語言
BCPL, PL/I, TMG英语TMG (language)
影響語言
C语言

B語言大約是於1969年時由美國貝爾實驗室電腦科學家──肯·湯普森丹尼斯·利奇的支持下設計出來的。肯·湯普森最初想在UNIX上開發一個Fortran編譯器,但後來引進了BCPL的風格,形成一個新的語言。

後來,丹尼斯·利奇以B語言為基礎開發出C語言,至此C語言漸漸發展成為目前世界上最常用的程式語言之一。

例子

下面是肯·湯普森在《B用户参考》中提供的源代碼[2]

/* The following function will print a non-negative number, n, to  the base b, where 2<=b<=10. This routine uses the fact that  in the ASCII character set, the digits 0 to 9 have sequential  code values. */ printn(n, b) {  extrn putchar;  auto a;  /* Wikipedia note: auto declares a variable with automatic  storage (lifetime is function scope), not "automatic typing"  as in C++11. */  if (a = n / b) /* assignment, not test for equality */  printn(a, b); /* recursive */  putchar(n % b + '0'); } 
/* The following program will calculate the constant e-2 to about  4000 decimal digits, and print it 50 characters to the line in  groups of 5 characters. The method is simple output conversion  of the expansion  1/2! + 1/3! + ... = .111....  where the bases of the digits are 2, 3, 4, . . . */ main() {  extrn putchar, n, v;  auto i, c, col, a;  i = col = 0;  while(i<n)  v[i++] = 1;  while(col<2*n) {  a = n+1 ;  c = i = 0;  while (i<n) {  c =+ v[i] *10;  v[i++] = c%a;  c =/ a--;  }  putchar(c+'0');  if(!(++col%5))  putchar(col%50?' ': '*n');  }  putchar('*n*n'); } v[2000]; n 2000; 

參見

引用

  1. ^ . [2021-03-14]. (原始内容存档于2015-02-10). 
  2. ^ Thompson, Ken. (PDF). Bell Laboratories. 7 January 1972 [21 March 2014]. (原始内容 (PDF)存档于17 March 2015). 

外部連結

b語言, 是一种通用的程序设计语言, 自從被c語言取代之後, 它幾乎已遭棄置, b语言設計者肯, 汤普森實作者肯, 汤普森, 丹尼斯, 利奇发行时间1969年, 54年前, 1969, 型態系統无类型, 所有东西都是字, 文件扩展名, b啟發語言bcpl, 英语, language, 影響語言c语言大約是於1969年時由美國貝爾實驗室的電腦科學家, 湯普森在丹尼斯, 利奇的支持下設計出來的, 湯普森最初想在unix上開發一個fortran編譯器, 但後來引進了bcpl的風格, 形成一個新的語言, 後來, 丹尼斯, . B語言是一种通用的程序设计语言 自從被C語言取代之後 它幾乎已遭棄置 B语言設計者肯 汤普森實作者肯 汤普森 丹尼斯 利奇发行时间1969年 54年前 1969 1 型態系統无类型 所有东西都是字 文件扩展名 b啟發語言BCPL PL I TMG 英语 TMG language 影響語言C语言B語言大約是於1969年時由美國貝爾實驗室的電腦科學家 肯 湯普森在丹尼斯 利奇的支持下設計出來的 肯 湯普森最初想在UNIX上開發一個Fortran編譯器 但後來引進了BCPL的風格 形成一個新的語言 後來 丹尼斯 利奇以B語言為基礎開發出C語言 至此C語言漸漸發展成為目前世界上最常用的程式語言之一 目录 1 例子 2 參見 3 引用 4 外部連結例子 编辑下面是肯 湯普森在 B用户参考 中提供的源代碼 2 The following function will print a non negative number n to the base b where 2 lt b lt 10 This routine uses the fact that in the ASCII character set the digits 0 to 9 have sequential code values printn n b extrn putchar auto a Wikipedia note auto declares a variable with automatic storage lifetime is function scope not automatic typing as in C 11 if a n b assignment not test for equality printn a b recursive putchar n b 0 The following program will calculate the constant e 2 to about 4000 decimal digits and print it 50 characters to the line in groups of 5 characters The method is simple output conversion of the expansion 1 2 1 3 111 where the bases of the digits are 2 3 4 main extrn putchar n v auto i c col a i col 0 while i lt n v i 1 while col lt 2 n a n 1 c i 0 while i lt n c v i 10 v i c a c a putchar c 0 if col 5 putchar col 50 n putchar n n v 2000 n 2000 參見 编辑BCPL C語言引用 编辑 B computer programming language 2021 03 14 原始内容存档于2015 02 10 Thompson Ken Users Reference to B PDF Bell Laboratories 7 January 1972 21 March 2014 原始内容 PDF 存档于17 March 2015 外部連結 编辑The Development of the C Language 页面存档备份 存于互联网档案馆 Users Reference to B Ken Thompson著 The Programming Language B 这是一篇與计算机相關的小作品 你可以通过编辑或修订扩充其内容 查论编 取自 https zh wikipedia org w index php title B語言 amp oldid 71573944, 维基百科,wiki,书籍,书籍,图书馆,

文章

,阅读,下载,免费,免费下载,mp3,视频,mp4,3gp, jpg,jpeg,gif,png,图片,音乐,歌曲,电影,书籍,游戏,游戏。