VENIAL

From Esolang
Jump to navigation Jump to search

VENIAL (VErne's Novice International Algorithmic Language) is an alternate history BASIC or FOCAL, adapting IAL (ALGOL 58) to a time-shared, line-numbered system for the IBM 7090. The primary inspiration was the ACM-GAMM committee record, Preliminary Report: International Algebraic Language[1]. FORTRAN II was a strong influence on VENIAL.

VENIAL is a work in progress of User:Jeffrey Henning.

The IBM 7090 had 36-bit word length, and this influenced the design of VENIAL.

Symbols

Symbol strings start with a letter and can be followed by any length of letters but only the first two letters differentiate the symbol (e.g., DESTINATION, DEST and DE all refer to the same variable or procedure). Only 702 symbols are permitted; 26 letters * (26 letters + null). The same symbol table is used for procedures and variables, so if a procedure is named DE then no variable can be named DE.

Math: +, -, * (multiplication), / (division), ^ (exponent) Comparison: =, /= (not equal), >, >=, <=, <

Statements

Every line of a VENIAL program has its own line number. The VENIAL-59 system supported line numbers from 1 to 4095. A line may contain multiple statements, delimited by a semicolon.

Wherever a logic structure expects a single statement, a series of statements may be substituted, but they must be bracketed by BEGIN; END.

Basic Statements

1. Assignment statement. The := symbol specifies assignment.

10 PI := 3.14159

2. Go to statement. The keyword GOTO specifies unconditional branching.

90 GOTO 10

3. If statement. The keyword IF evaluates an expression; if it is true, all subsequent statements on the line are executed.

20 IF X>0; Z := Z/X

4. For statement. Loops can be specified

10 FOR X := 1, 10; Y := Y + X
20 FOR COUNTDOWN := 10, -1, 1; TYPE COUNTDOWN

5. Alternative statements. Multi-part ifs can be specified.

20 IFEITHER X<0; Y := -1; ORIF X=0; Y := 0; ORIF X>0; Y := 1

6. Do statement. Calls a procedure.

30 DO 100

7. Stop statement. Ends execution

4095 STOP

8. Return statement. Returns execution from a procedure.?

190 RETURN

9. Input statement. Reads input from the teletype.

10 READ ANSWER

10. Output statement. Types output to the teletype.

10 WRITE `WELCOME'


Declarations

1. Type declarations. Unlike IAL, VENIAL does not require variables to be declared before they are used. All variables are floating-point numbers.

5. Comment declaration. A comment begins with the word comment and may contain any symbols other than the semicolon.

10 COMMENT A FIRST PROGRAM
20 COMMENT BY JEFFREY HENNING; DO 100

6. Procedure declaration. A procedure must be declared before it is used. A procedure name must be a valid variable name and may not otherwise be used as a variable.

10 PROCEDURE COUNTDOWN; FOR COUNTDOWN := 10, -1, 1; TYPE COUNTDOWN
10 PROCEDURE COUNTDOWN; BEGIN; FOR COUNTDOWN := 10, -1, 1; TYPE COUNTDOWN; TYPE `BLASTOFF!'; END

Reserved Words

  • BEGIN
  • DO
  • END
  • IF
  • IFEITHER
  • FOR
  • GOTO
  • ORIF
  • PROCEDURE
  • READ
  • RETURN
  • STOP
  • WRITE