LAB Compiler
A Turbo Pascal Project

OUTSTANDING ITEMS, BUGS, ETC
Download the LAB Compiler

The compiler generates commented 8086 assembler code, giving you the option to manually improve it prior to linking.
The runtime library is divided into manageable units. This is done to improve maintenance and future optimization of the code.

Files used to make executable machine code from Lab source files

LAB10A.EXE

LAB Compiler 1.0A

MASM.EXE

Microsoft Macro Assembler 5.10

LINK.EXE

Microsoft Overlay Linker 3.64

BIN.EXE

Freeware EXE2BIN Conversion

VIDEO_IO.ASM

Screen I/O Routines. Part of the LAB Run-Time Library

LAB.BAT

The Batch File used when compiling LAB Source

usage:
LAB <sourcefile> [/C]

Do not include the .LAB extension when specifying sourcefile. The /C switch causes all files generated except the .ASM and .COM file to be deleted. If you need the .OBJ, .MAP, .CRF, and .LST file, then you do not include the /C switch.

Additional files included in the package...

ARTLAB [--This file--]

ARTLAB.COM Text Viewer for [--this file--].

ERROR.LAB Source file with error (example)

ERROR.ASM Generated assembler file with Error Message...

The LAB Language

This is a short description of the programming language.

Lexical issues

The Lab programs are a collection of whitespace, identifiers, (comments,) literals, operators, separators, and keywords.

Whitespace

Lab is a free-form language. This means that you do not need to follow any special indentation rules. A program can be written all on one line or in any other strange way you feel like typing it, as long as there are at least one whitespace character between each token that was not already delineated by an operator or separator. In Lab, whitespace is a space, tab, or newline.

Tokens

Tokens are the smallest meaningful unit of text in the program, and are categorized as special symbols, identifiers, labels, numbers, and (string constants, not yet implemented).

Identifiers

Identifiers are used for label names, (procedure names,) constant and variable names. An identifier may be any descriptive sequence of letters, numbers, or the underscore. They must not begin with a number, lest they be confused with a numeric literal. Lab identifiers can be up to 16 characters long, and like the keywords they are not case-sensitive. Some examples of valid identifiers are:

AvgTemp
_ok
Index
årstall
a4
this_is_ok

Invalid identifiers include:

2count
hi-temp
not ok

Literals

--------

A constant value in Lab is created by using a literal representaton of it.

For example, here are some literals:

100

98.3

'S'

"this is ok"

From the top, the first literal specifies an integer, (the next is a floating

point value,) the third is a character constant, and the last is a string.

A literal can be used anywhere a value of its type s allowed.

Comments

--------

(--not yet implemented--)

Separators

----------

In Lab, there are a few characters that are used as separators. The most

commonly used separators in Lab is the comma and the parantheses.

The separators are shown in the following table:

Symbol Name Purpose

() Parantheses Used to contain list of parameters in

procedures. Also used for defining

precedence in expressions, containing

expressions in control statements, and

surrounding cast types.

, Comma Separates consecutive identifiers in a

variable declaration, and between several

parameters passed to a procedure.

. Period -- terminates the final end in a program

Key Words

---------

There are 11 reserved keywords currently defined in the Lab language.

These keywords, combined with the syntax of the operators and separators,

form the definition of the Lab language. These keywords cannot be used as

names for a variable, procedure, label, or constant etc.

BEGIN ENDIF PROGRAM WHILE

ELSE ENDWHILE READ WRITE

END IF VAR

ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ»

º In addition to these reserved keywords, you cannot use any º

º words (mnemonics) used by the macro-assembler either. º

ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ

Operators

---------

are classified as arithmetic operators and logical operators.

Binary Arithmetic Operators

+ ADDITION

- SUBTRACTION

* MULTIPLICATION

/ DIVISION

Unary Arithmetic Operator

- SIGN NEGATION

Relational (Logical) Operators

= EQUALS

<> NOT EQUALS

< LESS THAN

> GREATER THAN

<= LESS OR EQUAL

>= GREATER OR EQUAL

Boolean Operators

! NOT

& AND

| OR

# XOR

Assignment Operator

= ASSIGNMENT

 

SPECIAL SYMBOLS [ Single Characters ]

+ - * / = < > ( ) . , | # & !

SPECIAL SYMBOLS [ Character Pairs ]

<= >= <>

DATA TYPES

--supports only 16-bits Integer [word] type at this stage--

GLOBAL VARIABLES

--can be initialized--

CONDITIONAL STATEMENTS

IF <boolean expression> <statement> [<statement>]*

[ELSE <statement> [<statement>]*]

ENDIF

WHILE <boolean expression> <statement> [<statement>]*

ENDWHILE

PROCEDURES

WRITE(<integer expression>[,<integer expression>]*)

<video_io.asm>

The procedure supports only 16-bits unsigned integer expressions

at this stage, i.e. negative values are written as integers in

the upper range 8000h to FFFFh (with the sign bit 'set' to 1).

16-bits signed integers run up from 8000h (-32768) to FFFFh (-1)

and stop at 7FFFh (+32767). 16-bits unsigned integers run from

0000h (0) to FFFFh (65535).

Passing too many parameters (integer expressions) to the Write

procedure could cause Assembler Error A2053: Jump out of range

by n byte(s).

On 386/486 processors (jump) displacements can be 16-bits or

32-bits wide, the operand address must therefore be from -32768

to +32767 bytes from the current instruction.

On 8088/8086 processors this can only be from -128 to +127 bytes

from the next instruction.

¨