-
Notifications
You must be signed in to change notification settings - Fork 0
/
help.txt
35 lines (19 loc) · 2.85 KB
/
help.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Welcome to MinimalBASIC!
------------------------------------------------------------------------------
** Statements implemented in the minimal version of BASIC **
** REM **: This statement is used for comments. Any text on the line after the keyword REM is ignored.
** LET **: This statement is BASIC’s assignment statement. The LET keyword is followed by a variable name, an equal sign, and an expression. As in C++, the effect of this statement is to assign the value of the expression to the variable, replacing any previous value. In BASIC, assignment is not an operator and may not be nested inside other expressions.
** PRINT **: In minimal BASIC, the PRINT statement has the form: PRINT exp where exp is an expression. The effect of this statement is to print the value of the expression on the console and then print a newline character so that the output from the next PRINT statement begins on a new line.
** INPUT **: In the minimal version of the BASIC interpreter, the INPUT statement has the form: INPUT var where var is a variable read in from the user. The effect of this statement is to print a prompt consisting of the string " ? " and then to read in a value to be stored in the variable.
** GOTO **: This statement has the syntax ( eg. GOTO n )and forces an unconditional change in the control flow of the program. When the program hits this statement, the program continues from line n instead of continuing with the next statement. Your program should report an error if line n does not exist.
** IF **: This statement provides conditional control. The syntax for this statement is: IF exp1 op exp2 THEN n
where exp1 and exp2 are expressions and op is one of the conditional operators=, <, or >. If the condition holds, the program should continue from line n just as in the GOTO statement. If not, the program continues on to the next line.
** END **: Marks the end of the program. Execution halts when this line is reached. This statement is usually optional in BASIC programs because execution also stops if the program continues past the last numbered line. Table2. Commands to control the BASIC interpreter
**Commands to control the BASIC interpreter**
**RUN**: This command starts program execution beginning at the lowest-numbered line. Unless the flow is changed by GOTO and IF commands, statements are executed in line-number order. Execution ends when the program hits the END statement or continues past the last statement in the program.
**LIST**: This command lists the steps in the program in numerical sequence.
**CLEAR**: This command deletes the program so the user can start entering a new one.
**HELP**: This command provides a simple help message describing your interpreter.
**QUIT**: Typing QUIT exits from the BASIC interpreter by calling exit(0).
------------------------------------------------------------------------------
Have fun!