JVNTRAN is a very simple high level language designed to be what a high level language would have been like for John Von Neumann’s IAS machine had such a language been available. A JVNTRAN compiler is included in IASSim. JVNTRAN programs are created as text files and compiled by the emulator into IAS assembly language text files, which can then be assembled, loaded and executed on the simulated machine.
To create a JVNTRAN program from within IASSim, choose "New text" from the File menu.
To compile the program, choose "Save" from the File menu (if not previously saved), then choose "Compile" from the Execute menu. Errors will be indicated with appropriate dialog boxes. A program can be opened at any time using "Open text..." from the File menu.
The assembly language version created by the compiler can also be examined using "Open text..." from the File menu. It has the same name as the source JVNTRAN file, but with an extension of “.ias”. Assembly, loading into memory, and execution are also accomplished from the Execute menu.
Line comments are indicated with “//”. Anything after that on the line is ignored. Block comments begin with “/*” and end with “*/”. Anything between them is ignored.
JVNTRAN uses only upper case letters.
The following words have specific meaning in JVNTRAN and may not be used as variable or constant names: BOOLEAN, BREAK, CONSTANT, DO, ELSE, END, FALSE, HALT, IF, INTEGER, TRUE, WHILE
JVNTRAN supports integers from ‐239 to 239‐1. If no radix is specified, it is assumed to be decimal. Binary may be specified by prefixing the number with 0B, hex with 0X, e.g:
34333
0B011100
0XABCFFE41
‐4
Arithmetic overflow is not detected.
JVNTRAN supports two types of variables: INTEGER and BOOLEAN. INTEGER variables may contain any number from ‐239 to 239‐1. BOOLEAN variables may be either TRUE or FALSE.
Variables must be declared before they are used. A variable declaration consists of the variable’s type followed by its name. This may be followed by an optional equals sign and a value to give it an initial value. Here are some examples:
INTEGER N
INTEGER NUM2 = 0
BOOLEAN EXIT_CHECK = FALSE
Variable names must begin with a letter but can then include letters, underscores, or numbers. They cannot include white space. Variables can only be declared once.
In addition to the scalar variables described above, JVNTRAN supports 1‐dimensional arrays. These are indicated by following the variable name with an expression in parentheses indicating the size of the array, which must evaluate to a constant. Unlike scalar variables, arrays may not be initialized in a declaration. Here is an example:
INTEGER MY_VECTOR(5)
Individual array elements are accessed in the standard fashion, by supplying the variable name followed by a subscript in parentheses. Subscripts must be expressions that evaluate to integers. Subscripts are not checked for out‐of‐bounds accesses. The first element in an array is accessed with subscript number 1.
Constants may be declared similarly to variables, by adding the word CONSTANT before the type. Constant declarations require initialization. For example:
CONSTANT INTEGER DELTA = 5
JVNTRAN supports the unary integer operators: {+,‐}, binary integer operators: {+,‐,*,/}, and comparison operators: {<, <=, >, >=, ==, !=}, all with the standard meanings and precedence. It also supports the modulo operator %, a left shift operator << and a right shift operator >>. It supports the unary Boolean operator NOT {!}, and the binary Boolean operators AND and OR {&&, ||} .
Arguments on the right side of the shift operators << and >> (the number of bits to shift) must be constants. The right shift is arithmetic, shifting in the leftmost bit. “/” is truncating integer division, any remainder is discarded. If the remainder is needed, use %.
JVNTRAN supports an assignment operator {=}. Its left argument must be a variable, its right argument a data value or expression of the same type as the variable.
Operators and variables may be combined into expressions, using parentheses as appropriate to achieve the desired level of precedence. For example:
DATA + 5
‐B+X*(Y+DELTA)
A JVNTRAN program consists of multiple statements. White space in a statement is ignored, but it is recommended that statements be confined one to a line and indentations be used to improve readability.
In addition to variable and constant declarations, JVNTRAN supports the following statements:
Assignment statement
DO WHILE statement
BREAK statement
IF statement
HALT statement
The assignment statement changes the value of a variable. It consists of a variable, the assignment operator ‘=’, and an expression of the same type as the variable. Examples are:
DATA = DATA+5
TMP = X*X+Y*Y/3
The DO WHILE statement consists of the line “DO WHILE (exp)”, where "exp" is any Boolean expression, followed by one or more statements to be repeated, followed by “END DO”. The Boolean expression "exp" must be surrounded by parentheses. For example:
DO WHILE (I <= V_LENGTH)
V_START(I) = V_START(I) + N
I = I + 1
END DO
The BREAK statement consists of the word BREAK. It is placed inside the body of a DO WHILE statement. If executed, control proceeds to the point immediately after the end of the nearest containing DO WHILE.
The IF statement consists of the line “IF (exp)”, where exp is any Boolean expression, followed by one or more statements to be executed if exp is true, followed by END IF. It may be followed by an optional ELSE clause consisting of the word ELSE, a collection of statements to be executed if exp is false, followed by END ELSE. Boolean expressions must be surrounded by parentheses. For example:
IF ((A > B) && (C == D))
X = 3
Y = 3
END IF ELSE // this clause is optional, contains code to be executed if above expression is false
X = 4
END ELSE
The HALT statement consists of the word HALT. Its execution stops the program.
Anything not explicitly mentioned in this document is not supported. In particular, function calls, subroutines, I/O, exponentiation, vector operations, and floating point numbers are not supported.