⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 bwbasic.doc

📁 这是一个简易的basic语言解释器, 可供我们学习和改进.
💻 DOC
📖 第 1 页 / 共 4 页
字号:
                 (equals, not equals) can be performed.    Dependencies: STRUCT_CMDS   ------------------------------------------   Function:     SGN( number )   Description:  SGN returns the sign of the argument 'number', +1                 for positive numbers, 0 for 0, and -1 for negative numbers.   Dependencies: (core)   ------------------------------------------   Function:     SIN( number )   Description:  SIN returns the sine of the argument 'number'                 in radians.   Dependencies: (core)   ------------------------------------------   Function:     SPACE$( number )   Description:  SPACE$ returns a string of blank spaces 'number'                 bytes long.   Dependencies: MS_FUNCS   ------------------------------------------   Function:     SPC( number )   Description:  SPC returns a string of blank spaces 'number'                 bytes long.   Dependencies: MS_FUNCS   ------------------------------------------   Function:     SQR( number )   Description:  SQR returns the square root of the argument 'number'.   Dependencies: (core)   ------------------------------------------   Command:      STOP   Description:  STOP interrupts program execution. As implemented under                 bwBASIC, STOP issues a SIGINT signal.   Dependencies: (core)   ------------------------------------------   Function:     STR$( number )   Description:  STR$ returns a string giving the decimal (base 10)                 representation of the argument 'number'.   Dependencies: COMMON_FUNCS   ------------------------------------------   Function:     STRING$( number, ascii-value|string$ )   Description:  STRING$ returns a string 'number' bytes long consisting                 of either the first character of string$ or the character                 answering to the ASCII value ascii-value.   Dependencies: MS_FUNCS   ------------------------------------------   Command:      SUB subroutine-name   Description:  SUB introduces a named, multi-line subroutine. The                 subroutine is called by a CALL statement, and concludes                 with an END SUB statement.   Dependencies: STRUCT_CMDS   ------------------------------------------   Command:      SWAP variable, variable   Description:  SWAP swaps the values of two variables. The two variables                 must be of the same type (either numerical or string).   Dependencies: COMMON_CMDS   ------------------------------------------   Command:      SYSTEM   Description:  SYSTEM exits from bwBASIC to the calling program or                 (more usually) the operating system.   Dependencies: INTERACTIVE   ------------------------------------------   Function:     TAB( number )   Description:  TAB outputs spaces until the column indicated by                 'number' has been reached.   Dependencies: (core)   ------------------------------------------   Function:     TAN( number )   Description:  TAN returns the tangent of the argument 'number'                 in radians.   Dependencies: (core)   ------------------------------------------   Function:     TIME$   Description:  TIME$ returns the current time based on the computer's                 internal clock as a string in the form "HH-MM-SS".                 As implemented under bwBASIC, TIME$ cannot be used for                 assignment (i.e., to set the system time).   Note:	 bwBASIC presently (v2.10) does not allow assignment		 to a function.   Dependencies: COMMON_FUNCS   ------------------------------------------   Function:     TIMER   Description:  TIMER returns the time in the system clock in seconds                 elapsed since midnight.   Dependencies: MS_FUNCS   ------------------------------------------   Command:      TROFF   Description:  TROFF turns of the trace facility; see TRON.   Dependencies: COMMON_CMDS   ------------------------------------------   Command:      TRON   Description:  TRON turns on the trace facility. This facility will print                 each line number in square brackets as the program is                 executed.  This is useful in debugging programs with                 line numbers.  To debug an unnumbered program with                 TRON, call DO NUM first, but remember to call DO UNNUM                 before you save the program later.   Dependencies: COMMON_CMDS   ------------------------------------------   Function:     VAL( string$ )   Description:  VAL returns the numerical value of the string$.   Dependencies: COMMON_FUNCS   ------------------------------------------   Command:      VARS   Description:  VARS is a debugging command which prints a list of                 all variables defined which have global scope.   Dependencies: DEBUG   ------------------------------------------   Command:      WEND   Description:  WEND concludes a WHILE-WEND loop; see WHILE.   Dependencies: COMMON_CMDS   ------------------------------------------   Command:      WHILE expression   Description:  WHILE initiates a WHILE-WEND loop.  The loop ends with                 WEND, and execution reiterates through the loop as                 long as the 'expression' is TRUE (-1).   Dependencies: COMMON_CMDS   ------------------------------------------   Command:      WIDTH [# device-number,] number   Description:  WIDTH sets screen or device output to 'number'                 columns.  device-number specifies the device                 or file for oputput.   Dependencies: COMMON_CMDS   ------------------------------------------   Command:      WRITE [# device-number,] element [, element ]....   Description:  WRITE outputs variables to the screen or to a file                 or device specified by device-number.  Commas                 are inserted between expressions output, and strings                 are enclosed in quotation marks.   Dependencies: COMMON_CMDS   ------------------------------------------6. PREDEFINED VARIABLES   BWB.EDITOR$   BWB.FILES$   BWB.PROMPT$   BWB.IMPLEMENTATION$   The commands EDIT and FILES are pseudo-commands that launch   shell programs named in the variables BWB.EDITOR$ and BWB.FILES$,   respectively.  The default values for these variables can   be changed in bwbasic.h (DEF_EDITOR and DEF_FILES), or they   can be changed on the fly by the user.  An idea might be to   initialize these variables in "profile.bas" for specific   implementations; for instance, BWB.FILES$ might be defined as   "ls -l" on Unix systems or "dir" on DOS systems.   The preset variable BWB.PROMPT$ can be used to set the prompt   string for bwBASIC.  Again, it is suggested that a user-   selected promptcan be set up in a "profile.bas" to be   initialized each time bwBASIC starts.  Note that special   characters can be added to the prompt string, e.g.,      BWB.PROMPT$ = "Ok"+CHR$(10)   will give an "Ok" prompt followed by a linefeed.   The preset variable BWB.IMPLEMENTATION$ will return "TTY" for   the bwx_tty implementation and will return "IQC" for the   IBM PC or Compatibles with QuickC (bwx_iqc) implementation.   This may be useful in determing which commands and functions   (specifically CLS, LOCATE, and INKEY$) may be available. 7. UNIMPLEMENTED COMMANDS AND FUNCTIONS, and AGENDA FOR DEVELOPMENT   There are some items not implemented that have been so long   a part of standard BASICs that their absence will seem surprising.   In each case, though, their implementation would require opera-   ting-system-specific functions or terminal-specific functions   that cannot be universally provided. Some specific examples:   CLOAD	Relies on CP/M or MSDOS conventions for binary                executable files.    CONT		See RESUME below (programmer ignorance?).   DEF USR	Relies on CP/M or MSDOS conventions for binary                executable files.    FRE()	The ability to report the amount of free memory		remaining is system-specific due to varying patterns		of memory allocation and access; consequently this		ability is not present in ANSI or earlier versions                 of C and this function is not available in bwBASIC.   INPUT$()	C by itself is not able to read unechoed keyboard 		input, and can read keyboard input only after a 		Carriage-Return has been entered.   INP		Calls to hardware ports, like machine-language   		routines, are highly system-specific and cannot   		be implemented in C alone.   LLIST	See LPRINT below.   LPOS		See LPRINT below.   LPRINT	and LLIST, etc., require access to a printer device,   		and this varies from one system to another. Users   		might try OPENing the printer device on their own   		operating system (e.g., "/dev/lp" on Unix systems,   		or "PRN" under DOS) and see if printing can be done   		from bwBASIC in this way.   NULL		In this case, I am convinced that NULL is no longer		necessary, since very few printers now require NULLs		at the end of lines.   OUT		See INP above (calls to hardware ports).   PEEK()	PEEK and POKE enabled earlier BASICs to address   		particular memory locations. Although bwBASIC   		could possibly implement this command (POKE) and   		this function (PEEK()), the limitation would be   		highly limited by the different systems for   		memory access in different systems.   POKE		see PEEK() above.   RENUM	Since unnumbered lines can be entered and   		executed under bwBASIC, it would not be   		possible to implement a RENUM routine.   		Instead, bwBASIC uses DO NUM and DO UNNUM.   RESUME	Is this possible under C? If so, I   		simply have failed to figure it out yet.   		Mea culpa (but not maxima).   USR		See CALL and DEF USR above (machine language   		subroutines).   VARPTR	See PEEK and POKE above.   WAIT		See INP and OUT above.   There are other commands, functions, and implementation details   that I am working on, and which are on the agenda list for future   versions of bwBASIC.  These agenda include:   PARACT	i.e., the ability to execute PARallel ACTions. This   		is described in ANSI BASIC, although I have not seen it   		implemented before.  It will offer a rough, non-   		preemptive form of multitasking within the scope   		of a BASIC program. Programmers will note points at which   		there are already hooks for PARACT in bwBASIC.   XMEM		PC-type computers need to be able to use extended   		memory.  If we could use extended memory for program   		lines, variables, and function defitions, we could   		write much longer programs.  This would entail,   		however, a fairly serious rewriting of the program   		to utilize memory handles for these storage features   		instead of direct memory pointers.   Windows	The addition of memory handles in addition to the   		non-preemptive execution of program lines (in a   		crude form, already present) will make it possible   		to develop implementations for Windows and perhaps   		for other graphical user interfaces.  But what form   		should this take?  I have in mind presently a BASIC   		that would run in the background, appearing only   		as an icon in the GUI space, with pop-up editors   		and output windows. Thus, the interpreted language		would serve a purpose something like 'cron' (a task		scheduler) under Unix systems. You may have some		reflections that would help me in this.   Graphics	Here we face fairly critical differences in different   		styles and implementations of graphics, e.g., between   		GWBASIC, ANSI BASIC, VisualBASIC, etc. But it's   		possible that Graphics commands and functions could   		be added. These would all be implementation-specific.   The ANSI Standard for full BASIC does not specify which particular   commands or functions must be implemented, and in fact the standard   is very robust.  Perhaps no implementation of BASIC would ever   include all of the items, but some ANSI commands and functions which   remain unimplemented are:   ACCESS   ANGLE   AREA   ARITHMETIC   ARRAY   ASK   BSTR   BVAL   CEIL   CELLS   CLIP   COLLATE   CONNECT   COSH   DATUM   DEBUG   DECIMAL   DECLARE   DEGREES   DEVICE   DISCONNECT   DISPLAY   DOT   DRAW   ERASE   EVENT   EXCEPTION   GRAPH   HANDLER   IMAGE   KEY   LCASE   LINES   LOG10   LOG2   MAT   MIX   MULTIPOINT   OUTIN   OUTPUT   PARACT   PICTURE   PIXEL   PLOT   POINTS   RADIANS   RECEIVE   RENUMBER   REWRITE   ROTATE   ROUND   SEIZE   SEND   SHIFT   SINH   TANH   TIMEOUT   TRACE   TRANSFORM   TRUNCATE   UBOUND   UCASE   VIEWPORT   WAIT   VIEWPORT   ZONEWIDTH8. THE STORY OF BYWATER BASIC   This program was originally begun in 1982 by my grandmother, Mrs.   Verda Spell of Beaumont, TX.  She was writing the program using   an ANSI C compiler on an Osborne I CP/M computer and although my   grandfather (Lockwood Spell) had bought an IBM PC with 256k of   RAM my grandmother would not use it, paraphrasing George Herbert   to the effect that "He who cannot in 64k program, cannot in 512k."   She had used Microsoft BASIC and although she had nothing against   it she said repeatedly that she didn't understand why Digital   Research didn't "sue the socks off of Microsoft" for version 1.0   of MSDOS and so I reckon that she hoped to undercut Microsoft's   entire market and eventually build a new software empire on   the North End of Beaumont. Her programming efforts were cut   tragically short when she was thrown from a Beaumont to Port   Arthur commuter train in the summer of 1986. I found the source   code to bwBASIC on a single-density Osborne diskette in her knitting   bag and eventually managed to have it all copied over to a PC   diskette. I have revised it slightly prior to this release. You   should know, though, that I myself am an historian, not a programmer.9. COMMUNICATIONS:   email:  tcamp@delphi.com

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -