B語言是一种通用的程序设计语言,大約於1969年時,由美國貝爾實驗室的電腦科學家肯·湯普森在丹尼斯·利奇的支持下設計。
肯·湯普森最初想在UNIX上開發一個Fortran編譯器,但後來引進了BCPL的風格,形成一個新語言即B語言。後來,丹尼斯·利奇以B語言為基礎開發出C語言,自從C語言漸漸發展成為目前世界上最常用的程式語言之一之後,B語言幾乎已遭棄置。
例子
下面是肯·湯普森在《B用户参考》中提供的源代碼:
/* The following function will print a non-negative number, n, to
the base b, where 2
/* 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
參見
- BCPL
- C語言
引用
外部連結
- [http://cm.bell-labs.com/cm/cs/who/dmr/chist.html The Development of the C Language]
- [https://web.archive.org/web/20060706005453/http://cm.bell-labs.com/cm/cs/who/dmr/kbman.html Users' Reference to B,Ken Thompson著]
- [https://web.archive.org/web/20070808110320/http://cm.bell-labs.com/cm/cs/who/dmr/bintro.html The Programming Language B]
评论 (0)