Sideway
output.to from Sideway
BASIC


BASIC


Draft for Information Only

BASIC

The acronym BASIC stands for Beginner's All-purpose Symbolic Instruction Code. BASIC is a kind of elementary algebraic programming language developed by John G. Kemeny and Thomas E. Kurtz at Dartmouth College. The BASIC language is a simple native English-like programming language. The English-like feature with simple vocabulary and grammar makes BASIC language easier to be picked up by a beginner to write useful computer programs and understand the meaning of the program statements at the same time. The native programming feature with ordered statements, loops, functions and subrountines also makes BASIC language easier to be presented in a complete and precise way that both the programmer and computer can be understanded without ambiguities and redundancies. Besides, the simple feature with limited capability also makes BASIC programming language an easier language to learn. However, the simple native English-like programming feature is also the weakness of BASIC language because simple BASIC variables, functions or expressions only allow solving simple problems and the making use of simple tests and jumps, e.g if, gosub, or goto, in programming will make the program difficult to follow and maintain. 

The BASIC language is usually implemented as an interpreter, BASIC language becomes the most popular easy-to-learn language on the early personal computers with built-in BASIC language interpreter in the machine's firmware. Since BASIC programming language is originally designed for beginner to understand how to program a computer to perform tasks, BASIC language is not suitable for programming complex application. With the widespread of personal computer, many versins and extensions were introduced to the original BASIC language. Additional features, such as string manipulation, more data types, graphic support, and file system manipulation,  are added to BASIC language to increase the capability of BASIC language. Besides, some versions of BASIC language also supports structured programming by adding features, such as additional structure controls and proper subroutines supporting global and local variables.

Dartmouth BASIC Language (1964 version)

BASIC Program

A BASIC language program is composed of numbered lines of english-like statement. All lines in a BASIC program start with a line number. In general, each line is a statement used for instructing the computer to perform a specific task. Line numbers are used to identify the lines in the program. Besides, line numbers are also used to specify the order of lines of statement to be executed. Lines of statement can be entered in any order because the computer will sort all entered statements into order before processing. And therefore statements of a program can be changed or corrected by re-entering the line of statement with the same line number at any order. After the line number, each statement starts with a word of BASIC language vocabulary. All words used in a BASIC program can only be capital letters. Unlike English sentence, spaces have no significnce in a BASIC statement except those spaces in printed out messages.  All statements used in BASIC language are well defined without using the space character. The word after the line number is used to denote the type of statement. Sometimes comma is used as a word separator. Space may be used between words to make the statement more readable but space will be ignored during prcessing except those spaces in printed out messages.

Vocabulary

BASIC vocabulary word is the fundamental component of BASIC program.  A BASIC key word is used to specify the type of statement and to instruct the computer how to complete the task of the statement. BASIC vocabulary words are limited to those predefined key words that are understood by the BASIC interpreter.For example, READ, DATA, LET, GOTO, etc.

Function

BASIC function keyword is another common component of BASIC program.  A BASIC function key word is used to denote the name of common standard mathematical function and to instruct the computer how to process the argument enclosed in parentheses attached to the function name before return the result of functional computing. BASIC function keywords are also limited to those predefined functions that are understood by the BASIC interpreter. For example, SQR(), SIN(), EXP(), ABS(), etc. In other words,  a BASIC function keyword can be considered as a specific functional transformation of the argument enclosed in parenthese attached to the specified function name.

Variable

A variable in BASIC language is only used to represent a number similar to that used in a mathematical algebraic expression. Therefor a variable may be used to represent a known constant, number, which may be varied according to the given condition, or an unknown variable, number, which is an unknown to be determined from some known constants or varibles. The valid forms of a variable name in BASIC language are either any single english alphabet letter in Majuscule forms or any single english alphabet letter in Majuscule forms followed by any single numerical digit. For example, A, z9, etc. In other words, BASIC language can only have 286 variable names only.

Number

A numerial value is a number in BASIC language which may contain up to nine digits only with or without a decimal point or a minus sign. For example, -.123456789, -.000000001, 999999999. are a valid number in BASIC. In order to have a wider range of number support, the exponent concept are used by multiplying a number with a factor of a power of ten. A letter E is used to be attached to a  number representing "times ten to thee power" followed by the index of power. For example, -123.456=-123456E-3=-123456000E-6=-.000123456E6. The exponential letter can only be existed after a number. Since the exponential part cannot be existed alone, for example E2 is invalid for numeber 100, otherwise the exponential part will be interpred as a variable in BASIC. Besides, since BASIC language only support up to nine digits, -.0123456789 can only be expresented as -.123456789E-1.

Exponential Symbol

The exponential symbol supported in BASIC language is the letter E. And the exponential letter can only be existed after a number. For example, -.123456789E-1.

Grouping Symbol

The two grouping symbols supported in BASIC language are double quotes "" and parentheses (). The paired double quotes or quotation marks are used to wrap characters in between as one single message. For example, "This is a message". The paired parentheses or the open and close parentheses are used to group of the same level or order of operation as one single operation. For example (A+3). In general, a paired BASIC grouping symbol can be considered as a general function to return the argument enclosed.

String

A string message is a string in BASIC language which is wrapped characters emclosed by a paired double quotes.  For example, "This is a string".

Data Separator

The data separator supported in BASIC language are comma ",". The comma "," is used to separate two sucessive items in a list.  For example,  "100 READ X, Y" and "200 DATA 4, 5".

Array

Variables arranged in the form of lists and tables are also supported in BASIC language. For some applications, vector will be one dimensional array, list, and matrix will be two dimensional array, table. The valid form of a list or table name in BASIC language is any single english alphabet letter in Majuscule forms. A single letter can be used to denote both a simple varible and an array in the same BASIC program, since an array is alway followed by a parenthesis while a simple variable is not the case. And therefore a list and a table can not have the same name in the same BASIC program. For example, A(6), A(2,4). The subscripts inside the parentheses can be any positive integer or any expression. For example A(X), A(X,Y).

Arithmetic Operation

The basic mathematical operations, "+ (plus)", "- (minus)", "* (times)", "/ (divided by)" and "´┐¬ (to the power)" are supported in BASIC language. These arithmetic operation have the same meaning as used in an ordinary mathematical formula.

Expression

Expression or mathematical expression in BASIC language is an ordinary mathematical formula expressed in form of a single line expression. The fundamental mathematical expression are variables and numbers joined together by basic mathematical operations, "+ (plus)", "- (minus)", "* (times)", "/ (divided by)" and "´┐¬ (to the power)". Parentheses can also be used in an expression such that the mathematical expression are processed in correct order. Because the expression grouped inside a parentheses pair is always processed before the parenthesized is returned. Besides the multiplication sign cannot be omitted in an BASIC language expression. For example, 5*A+(7+B*6). Similarly mathematical functions can also be used in a mathematical expression. For example, 5*A+(7+B*SIN(6)).

Order of Operations

In general, the order of operations in an expression is parentheses, function, exponents, multiplication or division, addition or subtraction where parentheses have the highest order of priority. The expressiion inside a pair of parentheses is always computed first. Then the function of the expression is also processed before other arithmetic operations. Arithmetic operations in a mathematical expression are processed from left to right. However, if the arithmetic operation on the right of an arithmetic operation,  i.e. multiplication, division, addition, or subtraction,  is an exponent, then raising to a power will be processed before computing the original arithmetic operation on the left. Since multiplication and division have the same order of priority, both multiplication and division follow the rule of arithmetic operation and are processed from left to right accordingly. Similarly,  if the arithmetic operation on the right of an arithmetic operation,  i.e. multiplication, division, addition, or subtraction,  is an exponent, then raising to a power will be processed before computing the original arithmetic operation on the left.  

 

 


┬ęsideway

ID: 131000025 Last Updated: 2013/10/25 Revision:

IMAGE

Home (1)

Business

Management

HBR (3)

Information

Recreation

Hobbies (7)

Culture

Chinese (1013)new

English (330)

Reference (57)

Computer

Hardware (111)

Software

Application (169)

Digitization (20)

Numeric (19)

Programming

Web (376)

HTML

Knowledge Base

Common Color (1)

Html Entity (Unicode) (1)

OS (263)

MS Windows

Windows8.1 (1)

DeskTop (5)

Knowledge

Mathematics

Formulas (6)

Number Theory (51)

Algebra (14)

Trigonometry (18)

Geometry (18)

Calculus (66)

Engineering

Tables (8)

Mechanical

Control

Process Control (1)

Mechanics (1)

Rigid Bodies

Statics & Dynamics (128)

Fluid (5)

Fluid Kinematics (5)

Acoustics (19)

FiniteElement (2)

Biology (1)

Geography (1)

Valid XHTML 1.0 Transitional Valid CSS!
Nu Html Checker Firefox53 Chromena IExplorerna


facebook
Latest Updated Links

Copyright © 2000-2017 Sideway . All rights reserved Disclaimersfacebook last modified on 19 May 2015