Successfully reported this slideshow.
Your SlideShare is downloading. ×

BASIC Programming Language

Upcoming SlideShare
Basic programming concepts
Basic programming concepts
Loading in …3

Check these out next

1 of 109 Ad

More Related Content

Slideshows for you (20)

Similar to BASIC Programming Language (20)


Recently uploaded (20)

BASIC Programming Language

  1. 1. BASIC Includes Visual BASIC,, QuickBasic, PowerBasic, GW Basic, PowerBASIC and the BASIC Programming Language Shane Estavillo Jeffrey James Valerio
  2. 2. BASIC eginner ’sll Purposeymboli c nstructionod e It is a family of high-level programming languages, in other words, a multi platform language. One of the earliest and simplest high-level languages with commands similar to English. It can be learned with relative ease even by schoolchildren and novice programmers. It is in widespread use but has gotten little respect.
  3. 3. BASIC The language was based partly on the FORTRAN IV and partly on the ALGOL 60, with additions to make it suitable for timesharing. FORTRAN IV (1962) ALGOL 60 (1960 BASIC (1964)
  4. 4. Genealogy of BASIC The language was based partly on the FORTRAN IV and partly on the ALGOL 60, with additions to make it suitable for timesharing. BASI C (1964 ) QuickBASIC (1988) Visual BASIC (1990)
  5. 5. BASIC was first implemented on the GE-265 mainframe which supported multiple terminals.
  6. 6. Original BASIC Language Overview Very small and oddly, was not interactive. No means of getting input data from terminal. Programs were typed in, compiled and run, in sort of batch-oriented way. Had only 14 different statement types and a single data type, floating point, referred to as “numbers”. Overall, it was very limited language though quite easy to learn.
  7. 7. Significant Language Features Loops Input from the keyboard Menu Driven Applications System Commands - These are words that make the system perform a specific task immediately.
  8. 8. Significant Language Features User-Defined Functions Arrays, sorting, and searches Areas of Application BASIC has many strong points, such as: Easy to learn for beginners Structured Programming Subroutines Built-In Functions
  9. 9. Significant Language Features Adds powerful additional features for the advanced user Is designed for interactive use rather than batch work Lends itself to learning by hands-on practical use and is therefore suitable for both the professional and non-professional.
  10. 10. The goals of the system were: 1. It must be easy for non-science students to learn and use. 2. It must be pleasant and friendly. 3. It must provide fast turnaround for homework. 4. It must allow free and private access. 5. It must consider user time more important than computer time.
  11. 11. The eight design principle of BASIC: 1. Be easy for beginners to use. 2. Be a general-purpose programming language. 3. Allow advanced features to be added for experts (while keeping the language simple for beginners). 4. Be interactive. 5. Provide clear and friendly error messages. 6. Respond quickly for small programs. 7. Not to require an understanding of computer hardware. 8. Shield the user from the operating system.
  12. 12. Evaluation and Criticisms Poor structure of programs written in it. Early versions were not meant for serious programs of any significant size, though later versions can handle such tasks. Edsger W. Djikstra, a highly-respected computer proffessional that the use of GoTo statements, particularly in BASIC, promoted poor programming practices.
  13. 13. Then why BASIC is successful? Ease with which it can be learned and the ease with which it can be implemented, even on very small computers.
  14. 14. The original BASIC was designed in 1964 by John George Kemeny (right) and Thomas Eugene Kurtz (left) at Dartmouth College (now Dartmouth University) in New Hampshire, USA
  15. 15. Brief History of BASIC Before the mid-1960s, computers were extremely expensive and used only for special-purpose tasks. As prices decreased, from research aabs, computing went into commercial use. Newer computer systems then supported time-sharing, a system that allows multiple users or processes to use the CPU and memory.
  16. 16. Brief History of BASIC In the following years, as other dialects of BASIC appeared, Kemeny and Kurtz’s original BASIC dialect became known as Dartmouth BASIC. When it was implemented in minicomputers DEC PDP Series and the Data General Nova; HP-Time Shared BASIC System (1960s), BASIC acted merely as an interpreter rather than a compiler.
  18. 18. Brief History of BASIC It was the introduction of Altair 8800 “kit” microcomputer in 1975 that provided BASIC a path to universality. BASIC provided faster memory access for audio tapes and suitable text editors that time.
  19. 19. Brief History of BASIC In order to promote the language, it was available FREE OF CHARGE. One of the first to appear was the Tiny Basic originally written by Li-Chen Wang, a simple BASIC implementation. For 8080 machines like the Altair.
  20. 20. Brief History of BASIC MITS then released Altair BASIC, developed by Bill Gates and Paul Allen in 1975. Microsoft BASIC (widely known as MBASIC or M BASIC)was soon bundled with an original floppy disk based CP/M computers.
  21. 21. Brief History of BASIC The Atari 8-bit family had their own Atari BASIC that was modified in order to fit on 8 kB ROM cartridge. The BBC published BBC BASIC, developed for them by Acorn Computers Ltd, incorporating many extra structuring keywords.
  22. 22. Atari BASIC
  23. 23. Brief History of BASIC As early as 1979 Microsoft was in negotiations with IBM to supply them with a version of BASIC. Microsoft sold several versions of BASIC for MS-DOS/ PC-DOS including BASICA, GW-BASIC (a BASICA-compatible version that did not need IBM's ROM) and QuickBASIC.
  24. 24. Brief History of BASIC
  25. 25. IBM BASIC UI
  26. 26. Brief History of BASIC Turbo Pascal & Turbo C++-publisher Borland published Turbo BASIC 1.0 in 1985 (successor versions are still being marketed by the original author under the name PowerBASIC).
  27. 27. Brief History of BASIC These languages introduced many extensions to the original home computer BASIC, such as improved string manipulation and graphics support, access to the file system and additional data types. More important were the facilities for structured programming, including additional control structures and proper subroutines supporting local variables.
  28. 28. The Shift of BASIC into Visual BASIC The Visual BASIC introduced by Microsoft is difficult to consider to be really the original BASIC, since of its major shift towards being object- oriented and event-driven in perspective. VB Version 3.0 is widely considered the first relatively stable version.
  29. 29. Basic BASIC Syntax SYNTAX TYPICAL BASIC KEYWORDS Data manipulation LET: assigns a value (which may be the result of an expression) to a variable. DATA: holds a list of values which are assigned sequentially using the READ command.
  30. 30. Program flow control IF ... THEN ... ELSE: used to perform comparisons or make decisions. FOR ... TO ... {STEP} ... NEXT: repeat a section of code a given number of times. A variable that acts as a counter is available within the loop. WHILE ... WEND and REPEAT ... UNTIL: repeat a section of code while the specified condition is true. The condition may be evaluated before each iteration of the loop, or after. DO ... LOOP {WHILE} or {UNTIL}: repeat a section of code Forever or While/Until the specified condition is true . The condition may be evaluated before each iteration of the loop, or after. GOTO: jumps to a numbered or labelled line in the program.
  31. 31. Program flow control GOSUB: jumps to a numbered or labelled line, executes the code it finds there, but upon encountering the RETURN Command, it jumps back to the line following the line from which the jump occurred. This is used to implement subroutines. ON ... GOTO/GOSUB: chooses where to jump based on the specified conditions. See Switch statement for other forms. DEF FN: a pair of keywords introduced in the early 1960s to define functions. The original BASIC functions were modelled on FORTRAN single-line functions. BASIC functions were one expression with variable arguments, rather than subroutines, with a syntax on the model of DEF FND(x) = x*x at the beginning of a program. Function names were restricted to FN+one letter.
  32. 32. I/O: Input and Output PRINT: displays a message on the screen or other output device. INPUT: asks the user to enter the value of a variable. The statement may include a prompt message. TAB or AT: sets the position where the next character will be shown on the screen or printed on paper.
  33. 33. Miscellaneous Syntax REM: holds a programmer's comment or REMark; often used to give a title to the program and to help identify the purpose of a given section of code. USR: transfers program control to a machine language subroutine, usually entered as an alphanumeric string or in a list of DATA statements. TRON: turns on a visual, screen representation of the flow of BASIC commands by displaying the number of each command line as it is run. The TRON command, largely obsolete now, stood for, TRace ON. This meant that command line numbers were displayed as the program ran, so that the command lines could be traced. This command allowed easier debugging or correcting of command lines that caused problems in a program.
  34. 34. Miscellaneous Syntax Problems included a program terminating without providing a desired result, a program providing an obviously erroneous result, a program running in a non-terminating loop, or a program otherwise having a non-obvious error. (The command TRON has also entered popular cultural with the name of the 1982 Disney movie, "TRON," with a subsequent movie, "TRON: Legacy," a television series, "TRON: Uprising," and two video games, "TRON: Legacy," and "TRON:Evolution." In each of these entertainments the TRON command is personified as a character that battles against evil elements in programs.) TROFF: turns off the display of the number of each command line as command lines run after the command TRON has been used.
  35. 35. DATA TYPES AND VARIABLES Minimal versions of BASIC had only integer variables and one-letter variable names. More powerful versions had floating-point arithmetic, and variables could be labelled with names six or more characters long. String variables are usually distinguished in many microcomputer dialects by having $ suffixed to their name, and string values are typically enclosed in quotation marks. Arrays in BASIC could contain integers, floating point or string variables. Some dialects of BASIC supported matrices and matrix operations, useful for the solution of sets of simultaneous linear algebraic equations. These dialects would support matrix operations such as assignment, addition, multiplication (of compatible matrix types), and evaluation of a determinant. Microcomputer dialects often lacked this data type and required a programmer to provide subroutines to carry out equvalent operations. BASIC (PROGRAMMING LANGUAGE) IS AN EARLIER VERSION OF VISUAL BASIC. VB IS MODIFIED FOR PC USER U CAN SAY IT IS A GUI VERSION OF BASIC.
  36. 36. Sample BASIC Implementatio n
  37. 37. The next set of discussions are directly based on the Original Manual of the BASIC Programming Language designed for use in the Darthmouth Time-Sharing BASIC Programming
  38. 38. Observations
  39. 39. s
  40. 40. Expressions, Numbers and Variables
  41. 41. Expressions, Numbers and Variables
  42. 42. Expressions, Numbers and Variables
  43. 43. Expressions, Numbers and Variables
  44. 44. Expressions, Numbers and Variables
  45. 45. Expressions, Numbers and Variables
  46. 46. Parentheses
  47. 47. LET Function
  48. 48. Read and Data Functions
  49. 49. PRINT Functions
  50. 50. Print Functions
  51. 51. GO TO (Looping) & If-Then
  52. 52. GO TO (Looping) & If-Then
  53. 53. FOR and Next
  54. 54. FOR and Next
  55. 55. END Function
  56. 56. Revising Errors
  57. 57. Types of BASIC Unstructured BASIC Structured BASIC Object-Oriented BASIC or Visual BASIC
  58. 58. Unstructured BASIC These are the first-generation BASIC languages such as MSX BASIC and GW BASIC. Most support: Simple Data Types Loop Cycles Arrays
  59. 59. 10 PRINT "Hello World! " 20 GOTO 10 Sample Program for GW BASIC
  60. 60. Hello World !Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World!
  61. 61. 10 PRINT "Hello World! " 20 GOTO 10 This program prints the phrase “Hello World! “ infinitely. Sample Program for GW BASIC
  62. 62. 10 INPUT "ENTER TWO NUMBERS SEPARATED BY A COMMA: 20 LET S = N1 + N2 30 LET D = N1 - N2 40 LET P = N1 * N2 50 LET Q = N1 / N2 60 PRINT "THE SUM IS ", S 70 PRINT "THE DIFFERENCE IS ", D 80 PRINT "THE PRODUCT IS ", P 90 PRINT "THE QUOTIENT IS ", Q 100 END Sample Program for GW BASIC
  64. 64. Structured BASIC Second Generation BASICs are structured and procedure-oriented programming. Line numbering is omitted and then replaced with labels for GoTo and procedure. QuickBASIC and PowerBASIC are examples.
  65. 65. Sample PowerBASIC Program Function PBMain Print "Hello, World!" Waitkey$ End Function
  66. 66. Sample QuickBASIC Program #COMPILE EXE Function PBMain() as Long MsgBox "Hello World" End Function
  67. 67. BASIC with Object-Oriented features Third generation BASIC dialects such as Visual Basic and StarOffice Basic introduced features to support object- oriented and event-driven programming paradigm. Most built-in procedures and functions now represented as methods of standard objects rather than operators .
  68. 68. Visual BASIC Visual basic is derived form the BASIC programming languages, it is a Microsoft window programming language, visual basic program are created in an integrated development environment (IDE), which allows the programmer to create run and design visual basic programs conveniently it’s also allow a programmer to create working programs in a fraction of time that normally takes to code programs without using IDES.
  69. 69. Visual BASIC The wide spread use of BASIC Language with various types of computer (sometimes called hardware platform) led to many enhancement to the languages with the development of Microsoft windows graphical user interface (GUI) in the late 1980’s and the early 1990’s, the natural evolution of basic was visual basic which was created by Microsoft corporation in 1991.
  70. 70. Procedural BASIC: True BASIC True BASIC, C, Fortran, and Pascal are examples of procedural languages. Procedural languages change the state or memory of the machine by a sequence of statements. True BASIC is similar to F (a subset of Fortran 90) and has excellent graphics capabilities which are hardware independent. True BASIC programs can run without change on computers running the Macintosh, Unix, and Windows operating systems. We will consider version 3.0 (2.7 on the Macintosh) of True BASIC. Version 5 includes the ability to build objects such as buttons, scroll bars, menus, and dialog boxes. However, because we wish to emphasize the similarity between True BASIC and other procedural languages such as C, F, and Java, we do not consider these features.
  71. 71. Procedural BASIC: True BASIC PROGRAM product ! taken from Chapter 2 of Gould & Tobochnik LET m = 2 ! mass in kilograms LET a = 4 ! acceleration in mks units LET force = m*a ! force in Newtons PRINT force END
  72. 72. Procedural BASIC: True BASIC The features of True BASIC included in the above program include: The first statement is an optional PROGRAM header. The inclusion of a program header is good programming style.
  73. 73. Procedural BASIC: True BASIC Comment statements begin with ! and can be included anywhere in the program. PROGRAM, LET, PRINT, and END are keywords (words that are part of the language and cannot be redefined) and are given in upper case. The case is insignificant (unlike C, F, and Java). The DO FORMAT command converts keywords to upper case.
  74. 74. Procedural BASIC: True BASIC The LET statement causes the expression to the right of the = sign to be evaluated and then causes the result to be assigned to the left of the = sign. (The LET statement reminds us that the meaning of the = symbol is not the same as equals.) It is not necessary to type LET, because the DO FORMAT command automatically inserts LET where appropriate. The LET statement can be omitted if the OPTION NOLET statement is included.
  75. 75. Procedural BASIC: True BASIC True BASIC does not distinguish between integer numerical variables and floating point numerical variables and recognizes only two types of data: numbers and strings (characters). The first character of a variable must be a letter and the last must not be an underscore. The PRINT statement displays output on the screen. The last statement of the program must be END.
  76. 76. Sample True BASIC with input PROGRAM product2 INPUT m INPUT prompt "acceleration a (mks units) = ": a LET force = m*a ! force in Newton's PRINT "force (in Newtons) ="; force END
  77. 77. Visual BASIC Visual basic is the worlds most widely use RAD language, (Rapid Application Development (RAD) is the process of rapidly creating an application. Visual Basic provide a powerful features such as graphical user interface, events handling assess to Win 32 API, object-oriented features, error handling, structured programming and much more. Not until Visual Basic appeared, developing Microsoft windows based application was a difficult and cumbersome process. Visual basic greatly simplifies window application development. The advantages of visual basic programming language
  78. 78. Visual BASIC VB 1.0 was introduced in 1991. The drag and drop design for creating the user interface is derived from a prototype form generator developed by Alan Cooper and his company called Tripod. Microsoft contracted with Cooper and his associates to develop Tripod into a programmable form system for Windows 3.0, under the code name Ruby (no relation to the Ruby programming language).
  79. 79. Visual BASIC Features Visual Basic gives a disciplined approach to writing programs that are clearer than unstructured programs, easier to test, debug and can be easily modify. It allows for the creation of powerful and professional looking application with less time and coding. It allows for strong typing i.e. has wide variety of input data types and support Rapid Application Development (RAD).
  80. 80. Visual BASIC Features It has a complete edifying and debugging facilities and has the ability to generate a Dynamic Link Libraries (DLL`S), it allows for easier management of document and it is easy to learn. Visual Basic is a complete form of package for building user interface Visual basic is a fairly easy language to pick up. However, it is generally not used to make very large applications. VB was also created for MS Windows.
  81. 81. Sample VB Program Private Sub Form_Load() ' Execute a simple message box that says "Hello, World!" MsgBox "Hello, World!" End Sub
  82. 82. Visual Basic Timeline
  83. 83. REMEMBER Please do not be mistaken by BASIC and Visual BASIC. BASIC (PROGRAMMING LANGUAGE) IS AN EARLIER VERSION OF VISUAL BASIC. Visual BASIC is MODIFIED for personal computer users, so we can say that it is a GUI VERSION of BASIC.
  84. 84. Prepared by: Jeffrey James L. Valerio Shane Estavillo

Editor's Notes

  • Type 4 2