User Tools

Site Tools


basic_language

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

basic_language [2021/03/13 06:30] – created hc9basic_language [2023/06/30 00:18] (current) – upsize all the section headings peteyboy
Line 1: Line 1:
 ===== BASIC ===== ===== BASIC =====
  
-=== The basics of BASIC ===+==== The basics of BASIC ====
  
 BASIC, which stands for **B**eginners **A**ll-Purpose **S**ymbolic **I**nstruction **C**ode is a programming language which was created at Dartmouth University by John Kemeny and Thomas Kurtz in the early 1960's. BASIC's authors intended to create a programming language and environment which would be useful to people who's primary interest was something other than computer programming. It was intended to be used by average users, scientists, and programming students alike. BASIC was instantly popular among the students and faculty of Dartmouth, and it saw rapid adoption on other systems. When the microcomputer revolution started to take hold in the 1970's and 1980's, BASIC was the default user environment of choice. As a result, many of today's programmers cut their teeth on BASIC. This tutorial will help you get started with this wonderful little language. BASIC remains a very easy to learn language, and it is great for writing small programs. Best of all, a lot of the concepts in BASIC transfer to other languages, so this can serve as a great jumping off point for your programming career! BASIC, which stands for **B**eginners **A**ll-Purpose **S**ymbolic **I**nstruction **C**ode is a programming language which was created at Dartmouth University by John Kemeny and Thomas Kurtz in the early 1960's. BASIC's authors intended to create a programming language and environment which would be useful to people who's primary interest was something other than computer programming. It was intended to be used by average users, scientists, and programming students alike. BASIC was instantly popular among the students and faculty of Dartmouth, and it saw rapid adoption on other systems. When the microcomputer revolution started to take hold in the 1970's and 1980's, BASIC was the default user environment of choice. As a result, many of today's programmers cut their teeth on BASIC. This tutorial will help you get started with this wonderful little language. BASIC remains a very easy to learn language, and it is great for writing small programs. Best of all, a lot of the concepts in BASIC transfer to other languages, so this can serve as a great jumping off point for your programming career!
Line 24: Line 24:
 </code> </code>
  
 +=== Try This Yourself ===
 In fact, why don't we try this out in one of our several BASIC interpreters! Go ahead and fire up bwbasic. To do this, just type "bwbasic" at the sdf prompt. Type in the program listed above, and then type RUN and press enter. Once you've been greeted enough times, press Ctrl-C to halt the program. The hole session should look like this: In fact, why don't we try this out in one of our several BASIC interpreters! Go ahead and fire up bwbasic. To do this, just type "bwbasic" at the sdf prompt. Type in the program listed above, and then type RUN and press enter. Once you've been greeted enough times, press Ctrl-C to halt the program. The hole session should look like this:
  
Line 68: Line 69:
 To exit bwbasic, just type "quit" and press enter. To exit bwbasic, just type "quit" and press enter.
  
-=== Structure of BASIC Lines of Code ===+==== Structure of BASIC Lines of Code ====
  
 Ok, so let's unpack what we just did a little bit. The basic layout of a BASIC statement works like this: Ok, so let's unpack what we just did a little bit. The basic layout of a BASIC statement works like this:
Line 98: Line 99:
 GOTO is a command which tells them computer what line to execute next. Normally, the computer will just step through the lines of the program in order, but when it hits a GOTO, that's your chance to send it somewhere else. Here, we are sending it back to line 10. This causes it to print out "HELLO" again, then it hits line 20 again, and then it goes back to 10. This will go on and on forever, or until someone stops the program. Computers are very patient, so you can run this to your heart's content! GOTO is a command which tells them computer what line to execute next. Normally, the computer will just step through the lines of the program in order, but when it hits a GOTO, that's your chance to send it somewhere else. Here, we are sending it back to line 10. This causes it to print out "HELLO" again, then it hits line 20 again, and then it goes back to 10. This will go on and on forever, or until someone stops the program. Computers are very patient, so you can run this to your heart's content!
  
-=== The BASIC Line Editor ===+==== The BASIC Line Editor ====
  
 Before we go any further with the language, we should explore what's going on with those line numbers. The answer lies in BASIC's origins. Originally, BASIC was run on a GE-235 running Dartmouth's Time Sharing System. The primary mode of interface was a teletype printer (this was the 1960's after all!) so everything was constantly being typed out to paper. This meant that modern text editing just wasn't available to BASIC programmers. To combat this, Kurtz and Kemeny implemented a line based editing scheme. The line numbers were the key to this. Before we go any further with the language, we should explore what's going on with those line numbers. The answer lies in BASIC's origins. Originally, BASIC was run on a GE-235 running Dartmouth's Time Sharing System. The primary mode of interface was a teletype printer (this was the 1960's after all!) so everything was constantly being typed out to paper. This meant that modern text editing just wasn't available to BASIC programmers. To combat this, Kurtz and Kemeny implemented a line based editing scheme. The line numbers were the key to this.
Line 131: Line 132:
 So in short, these line numbers are both your labels in your program, and they are also a means to edit your program. Of course, I should mention that not all BASIC interpreters support this sort of direct editing. In those cases, you'll want to edit your program in a standard text editor (like ed!) [ok, or vi or emacs]. But for that old-school feel, you'll want to use line number editing. So in short, these line numbers are both your labels in your program, and they are also a means to edit your program. Of course, I should mention that not all BASIC interpreters support this sort of direct editing. In those cases, you'll want to edit your program in a standard text editor (like ed!) [ok, or vi or emacs]. But for that old-school feel, you'll want to use line number editing.
  
-=== Available BASIC Interpreters at SDF ===+==== Available BASIC Interpreters at SDF ====
  
   * bwbasic   * bwbasic
basic_language.1615617036.txt.gz · Last modified: 2021/03/13 06:30 by hc9