词条 | Bs (programming language) |
释义 |
bs was a programming language from Apple Inc. that shipped with A/UX. It was described by Apple as "a compiler/interpreter for modest-sized programs".[1][2] It provides an interactive prompt or accepts a file containing commands. HistoryThe original man page is dated January 1992 and describes bs as "a language that is a remote descendant of BASIC, SNOBOL4, and C".[3] The "Semi-Official FAQ List for A/UX" page corroborates this claim by describing bs as a "kinda-BASIC interpreter".[2] Design and Features"The language is designed for programming tasks where program development time is as important as the resulting speed of execution. The language minimizes the formalities of data declaration and file manipulation. Line-at-a-time debugging, the trace and dump keywords, and useful run-time error messages simplify program testing. Furthermore, you can debug incomplete programs, test inner functions before outer functions have been written, and test outer functions before inner functions have been written."[3] Syntax ExamplesThe following examples are derived from the original man page.This example uses bs as a calculator: $ bs
186000 * 5280 * 12 / 1e9 11.78496 ...
int = .06 / 4 bal = 1000 for i = 1 5*4 bal = bal + bal*int bal - 1000 346.855007 ... exit This example is the outline of a typical bs program:
var1 = 1 open("read", "infile", "r") ...
while ?(str = read) ... next
close("read") ...
exit
run This example demonstrates I/O:
open("read", "oldfile", "r") open("write", "newfile", "w") ... while ?(write = read) ...
close("read") close("write")
open("ls", "!ls *", "r") open("pr", "!pr -2 -h ’List’", "w") while ?(pr = ls) ... ...
close("ls") close("pr") This command line shows a way of running bs: The example compiles and executes the file named program as well as any statements typed from standard input. The arguments 1, 2, and 3 are passed as arguments to the program when it executes. References 2 : Programming languages|Apple Inc. software |
随便看 |
|
开放百科全书收录14589846条英语、德语、日语等多语种百科知识,基本涵盖了大多数领域的百科知识,是一部内容自由、开放的电子版国际百科全书。