Compiled, It Probably Won't Work Clude an Integrated Editor, Compiler
Total Page:16
File Type:pdf, Size:1020Kb
code, exits to the operating system, and runs the compiler. The compiler File Edit Pieu Search Run Debug Calls Options Help HELP: Table of Contents often finds typing and syntax errors, <Help on Help 'Contents, index Product Support Copyright= which means that the person doing Using QuickBASlC> BASIC Programming Language programming has to re-edit the file - 'Shortcut Key Summary: - Functional Beyuord Lists and compile it again. Edit Keys' - :Syntax Notation Conventions Once the program is successfully View Keys- Search Keys - Fundamental Building Blocks' compiled, it probably won't work 'Run and Debug Keys - Data types> Help Keys - Expressions and Operators correctly. So the programmer tries to - Nodules and Procedures figure out what went wrong, and Limits to QuickBASIC- - Selected Programs Version 1.5 Differences then makes corrections to the source - QB Command Line Options, - ASCII Character Codes code and starts the entire process Survival Guide - 'Keyboard Scan Codes over. Modern compilers often in- 5Bh 7uLML ORS)! ' This program graphically demonstrates six common sorting algorithms. Itlu t clude an integrated editor, compiler prints 25 or 13 horizontal bars, all of different lengths and all In random and debugger that make the process order, then sorts the bars from smallest to longest. less painful, but it still can be slow. Immediate The other group of languages is <ShiftF1=Heip> <F6=gindou> <F2=Subs> <F5=Bun> <FB=Step> om based on interpreters instead of com- Help table of contents, along with a bit of a program. pilers. The interpreter takes the code that you write and executes it one line or statement at a time. Instead of cre- This enables a programmer to type BASICA or have a short loader pro- ating a stand-alone program (a .COM and run a program without ever leav- gram called BASICA. These con- or .EXE file in the DOS world), an ing the interpreter and returning to flicting names seem to confuse users interpreter simply runs your source the operating system. That ease of even more.) code. Programmers still have to test use makes BASIC ideal for quick and BASICA and GWBASIC are little and rewrite code, but they don't have simple projects. changed from their early eight -bit an- to wait for a compiler to read and cestors. By today's programming translate the entire program before standards, they're archaic and out- the program can run. BASIC and DOS dated languages. This doesn't mean There are advantages to both sys- When IBM produced the first PC, it that they're useless; many good pro- tems. Compilers ensure that an entire put a small version of BASIC in the grams have been written in BASICA program is syntactically correct- computer's ROM chips. A user could and it's possible to write others. But they don't produce anything while turn on the machine without a disk, most good BASIC programmers the code contains typing errors. In- and BASIC would appear, just as it have moved on to more modern ver- terpreters, on the other hand, only did on other microcomputers like the sions of the language. look at one line at a time; so they may Apple II and TRS-80. The first ver- The most popular modern versions never check lines that don't happen to sion of PC DOS included a disk - of BASIC are QuickBASIC (QB) be executed. But interpreters start to based BASIC called BASICA, which version 4.5, BASIC Professional De- run a program as soon as they read the was an extension of the BASIC in velopment System (PDS) 7.0, and first line of source code. In essence, ROM. Every version of PC DOS PowerBASIC. The first two are pub- compile each line as it's running. since then, and every IBM personal lished by Microsoft; the third is from It's generally easier to write and computer, has continued to split SPECTRA Publishing. PowerBASIC debug a program for an interpreter. BASIC between built-in ROMS and was originally distributed by Borland But the program will always run a disk -based program. International as TurboBASIC. When more slowly, since the interpreter is Most versions of MS-DOS also Borland discontinued the product, never free of the job of translating include a version of BASIC called SPECTRA Publishing (1030D E. each line, one at a time. Also, if you GWBASIC. BASICA and GWBASIC Duane, Sunnyvale, CA 94086) bought want to share an interpreted program have the same functionality, but the program and has been updating with someone else, you have to make GWBASIC is self-contained because and distributing it ever since. (Up- sure that you both have a copy of the non -IBM computers can't legally grades are available for $65 when ac- same interpreter. And you can't be contain IBM's BASIC ROM code. companied by the old version's serial sure that someone else won't read It's possible to run GWBASIC on an number.) your program and use your ideas in IBM computer, but if you try to run My favorite of the trio is QB 4.5; his or her own programs. IBM's BASICA on a non -IBM com- PDS 7.0 is much the same but with a Languages like Fortran, C and puter, you face certain lock -up. This lot more advanced features and a Pascal have traditionally been imple- incompatibility between PC -DOS much higher price tag. QuickBASIC mented as compilers, and languages and MS-DOS seems to confuse users and PowerBASIC have list prices like BASIC, dBASE and most but serves little other purpose, except just under $100 and street prices less spreadsheets have been implemented that BASICA.EXE is smaller than than $70. as interpreters. The earliest micro- GWBASIC and loads from disk If you need to write very large and computer BASICs integrated a sim- slightly faster. (Some versions of MS- complex programs in BASIC, PDS ple line editor with the interpreter. DOS have renamed GWBASIC as 7.0 is your best compiler choice. Say You Saw It In ComputerCraft August 1991 / COMPUTERCRAFT / 59 .