
Calhoun: The NPS Institutional Archive Theses and Dissertations Thesis Collection 1976-12 A microprocessor implementation of extended basic Eubanks, Gordon Monterey, California: Naval Postgraduate School http://hdl.handle.net/10945/17862 ' IIIIWiHPHIH '•'''' ••'• i ' BttwJS»Wffifflptt«ar- ' ' '' ; v,v " ' ' :; IWUIIi OT ;V; ; .„' WOLEY KNOX LIBRARY WVALPOSTGRAOUATI SCHOOL MA ... :: il::l -- Monterey, California ''^ 1 i J ma Stsssti/ jj A MICROPROCESSOR IMPLEMENTATION OF EXTENDED BASIC by Gordon Edwin Eubanks , Jr December 1976 Thesis Advisor: Gary A. Kildall Approved for public release; distribution unlimited. T17796A UNCLASSIFIED DUDLEY KNOX LIBRARY SECURITY CI ASSIF iCATlON OF THIS PAGE (T-?.en Data E.-WOffl; 1 ** '""1 READ INSTRUCTIONS I pA.""I DTD^VT^T r M TUT ATI^-5J »->- i«L^t w .. • — — — w. ._.»... .;^..i • — BEFORE COMPLETING FORM 2. GOVT ACCESSION KO.{ l. RECIPIENT'S CATALOG NUMBER . kepokT nuujln *. TYPE OF REPORT A PERIOD COVERED 4. TITLE (and Submit) Master's Thesis; A Microprocessor Implementation of December 1976 Extended Basic 4. PERFORMING ORO. REPORT NUMdER 4. OR GRANT NLMBERf*) 7. AUTHORf*; CONTRACT Gordon Edwin Eubanks , Jr. ORGANIZATION NAME AND AODRESS 10. PROGRAM ELEMENT. PROJECT. TASK i. PERFORMING AREA * WORK UNIT NUMBERS Naval Postgraduate School Monterey, California 93940 12. REPORT OATE II. CONTROLLING OFFICE NAME AND ADDRESS December Naval Postgraduate School 1976 13. MUMSER OF PAGES Monterey, California 93940 194 IS. SECURITY CLASS, (at thlo tdpert) Ti. MONITOHING AGENCY NAME * AOOR ESSf" dlllarent ham Controlling OlUce) Unclass if ied Naval Postgraduate School Monterey, California 93940 lia. D^CLASSIFICATION/OOWNGRAOING SCHEDULE l«. DISTRIBUTION STATEMENT (el thia Raeett\ Approved for public release; 1 dis.tribu-tion-urir,i.m, iteci'.* dltteteni ham Report) 17. DISTRIBUTION STATEMENT (el (ho aeatracl entered in Black 20, II <•. SUPPLEMENTARY NOTES Identity ay eloak nuateat) It. KEY WORDS (Continue on terotae aide II neceeemry and BASIC Extended BASIC Interpre te r Compiler Microprocessor aleak moaeet) 20. ABSTRACT (Continue en ravotaa aide II noceaaavy «wf identity by The design and implementation of an extension to the BASIC programming language for use on a microprocessor-based system has been described. The implementation is comprised of two subsystems, a compiler which generates code for a hypothetical zero-address machine and a run-time monitor which interprets this code. The design goals, solutions, and recommendations for further expansion of the system have been presented. The system '™" EDITION OP I NOV »» IS OBSOLETE DO , n 1473 UNCLASSIFIED S/N 0102-014-6601 I (Page 1) SECURITY CLASSII ' THIS PAOE (When Del. enteral) 1 UNCLASSIFIED ftCUWTv CLASSIFICATION OF THIS p»GEC*>i«i D»ia enfr»J 20. (cont.) was implemented in PL/M for use in a diskette-based environment DD Form 1473 1 Jan 73 unclassified b/ N 0102-014-6601 SECURITY CLASSIFICATION OF THIS F<AGEr»?<«n Dmlm Em»rmd) 2 A Microprocessor Implementation of Ext ended Basic by Gordon Edwi n £ubanks , Jr. Lieutenant/ United States Navy B.S.r Oklahoma State University, 1968 Submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE IN COMPUTER SCIENCE f rom the NAVAL POSTGRADUATE SCHOOL DECEMBER 1976 c . ABSTRACT The design and implementation of an extension to the BASIC programming language for use on a m i roDrocessor-based system has been described. The implementation is comprised of two Subsystems* a comoiler which generates code for a hypothetical zero-address machine and a run-time monitor which interprets this code. The design goals* solu- tions* and recommendations for further expansion of the system have been presented. The system was implementea in P L / M for use in a diskette-based en v i ronmen t CONTENTS I. INTRODUCTION 9 A. HISTORY OF THE BASIC LANGUAGE 9 8. THE USE OF BASIC WITH MICROCOMPUTER SYSTEMS 10 C. OBJECTIVES OF THE BASIC-E LANGUAGE 11 II. LANGUAGE SPECIFICATION 13 A. THE PROPOSED STANDARD FOR BASIC 13 1. Dartmouth Basic 13 2. The ANSI Standard 14 B. FEATURES OF THE BASIC-E LANGUAGE 14 1. Arithmetic Processing 15 2. Readability IS 3. Control Structure 16 4. Strinq Processing.. 16 5 . Files 18 C. EXAMPLES OF BASIC-E PROGRAMS 20 1. Fibonacci Number Generator 2 2. Label Generating Program 21 III. IMPLEMENTATION 22 A. SYSTEM DESIGN 22 6. TmE BASIC-E MACHINE 23 1. Introduction 23 2. Basic-E Machine Memory 24 M 3. The Basic-E a c h i n e Architecture 21 a. Description of Machine Instructions..... 29 . b. Literal Data References 30 c. Arithmetic Operators 30 d. String Operators 31 e. Stack Operators.... 33 f. Program Control Operators 33 g. Input/Output Operators 34 h. Built-in Functions 37 C. COMPILER STRUCTURE 41 1. Compiler Organization 41 2 Scanner 41 3. Symbol Table 45 4. Parser 50 5. Code Generation 51 a. Basic-E Language Structure..... 52 b. Assignment Statements and Expressions... 53 c. Control Statements 56 d. Declaration Statements 58 e. Input/Output Statements 59 0. RUN-TIME MONITOR STRUCTURE 62 1. Organization 6? 2. Initializer Program b2 3. Interpreter • 63 4. Floating-Point Packaae b5 IV. RECOMMENDATIONS FOR EXTENSIONS TO BASIC-E 66 APPENDIX I - 6ASIC-E LANGUAGE MANUAL 68 APPtMOlX II - COMPILER ERROR MESSAGES 128 APPENDIX ill - RUN-TIFF. MONITOR ERROR MESSAGES 130 APPENDIX IV - OPERATING INSTRUCTIONS FOR BASTC-E 131 PROGRAM LISTING - BASIC-E COMPILER 13a PROGRAM LISTING - BUILD BASIC-E MACHINE 163 PROGRAM LISTING - BASIC-E INTERPRETER 168 LIST OF REFERENCES 193 INIIIAL DISTRIBUTION LIST 19a . AKNOWLEDGEMENTS Basic-E was an outgrowth of a class project for a com- piler design course taught at the Naval Postgraduate School by Dr . b a r y A. Kildall. The efforts of the members of this class provided the foundation for this undertaking. Subse- quently/ Glade H o 1 y o a k and Allan Craig assisted in the development of the project. Their contribution was substan- tial. The continued suooort and assistance provided by Or, Kildall was instrumental in the completion of this thesis. I extend my appreciation for his assistance and my resoect for his knowledge of Computer Science. Special thanks is also offered to the staff of the W R. Church Computer Center* Naval Postgraduate S c n o o 1 / for their patience and technical assistance. Finally* the effort of Jane Foust in oroof-reaaing this report is very much appreciated. I. INTRODUCTION A. HISTORY OF THE BASIC LANGUAGE The Beginner's All-Purpose Symbolic Instruction Code (Basic) was developed at Dartmouth College to provide a sim- ple/ interactive language for casual computer users with applications in scientific computation [<£] . To meet this goal/ a limited vocabulary of instructions was included in the original definition of Basic. There was no concept of data typing ana there were no default conditions to memor- ize. The interactive mode provided an ideal man/machine interface for creating and debuaging programs/ while the features of the language were well-suited for the expression of engineering problems. Since this type of environment satisfied the needs of a wide range of potential computer users/ Basic was adapted by a number of universities and commercial firms. In particular/ timesharing service bureaus saw the potential for exoanded computer usage among non-computer specialists by Droviding its customers with the Basic language 110] . This led to the development of a number of dialects of Basic and to many extensions which satisfied specialized users. As the use of Basic increased and extensions to the language proliferated/ the need for standardization became a concern among computer specialists tldJ. This concern led . to the formation, in 1974, of committee X3J2 of the American National Standards Committee which was tasked with develop- ing a standard for the Basic programming language. The result of this effort was the Proposed American National Standards Institute (ANSI) standard for Minimal Basic [4] This standard establishes a minimum set of features which should be included in the implementation of a Basic language processor. While the standara provides arithmetic and very simple string processing capabilities, it does not consider the more extensive features which led to the need for stan- dardization in the first place. In a recent article by Lientz [9] , the different commercially available Basic language processors were compared. This survey indicated that many Basic processors tend to provide similar features and include extensive facilities beyond those in the ANSI standard discussed above. B. THE USE OF BASIC WITH MICROCOMPUTER SYSTEMS Basic is becoming a widely used microprocessor applica- tion language. Typical of the many commercially available Basic interpreters is the Mtair Basic f 1 J . Available in 4K, 8K, and 12K versions, it provides ex t ens i ons _ wh i c h allow string and file processing and a wide range of predefined functions. The l^K version operates in conjunction with a flopoy-disk system. The IBM 5100 portable computer includes the Basic language implemented in read-only memory 151 . The language 10 provides stream data files* string manipulation including substring operations* matrix operators* and hard-copy out- put . Although both of the basic language processors described above include powerful extensions to the language* they have the followina limitations. First* the entire source program must reside in memory at one time. This limits the size of programs which may be executed and thus discourages the use of remarks and indentation to show structure. Readability is limited by the restriction that identifiers consist of a single letter or a letter and a number. Finally* it is dif- ficult for individuals to modify the system to support specific applications or devices. C. OBJECTIVES OF THE 8ASIC-E LANGUAGE Basic-E was designed to provide all the arithmetic pro- cessing features of the proposed standard for basic as well as extensions and enhancements to the language.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages395 Page
-
File Size-