Bartels :: Bartels AutoEngineer :: BAE Documentation :: User Language Programmer's Guide :: Programming System :: Conventions |
Bartels User Language - Programmer's Guide3.1 Conventions |
![]() |
The Bartels User Language programming system consists of the Bartels User Language Compiler and the Bartels User Language Interpreter. The Compiler translates User Language source code into User Language machine code (programs or libraries), performs static library linking and generates information required for dynamic linking. The User Language Interpreter is used for (dynamically linking and) executing User Language machine programs. Since the User Language Comiler and the User Language Interpreter are applied time-independent (i.e., they are implemented in different program modules), the following conventions are required for correct program access.
The
Bartels User Language Compiler stores successfully translated
User Language programs (or libraries) to the
ulcprog.vdb
file of the
Bartels AutoEngineer programs directory. The name of the machine program emerges from the program source code file name. The current
User Language Compiler version and a caller type coding (determining the compatible
Bartels User Language interpreter environments) are stored with the machine program code. The Compiler also stores any information required for dynamic link processes (i.e., library linking to be applied at program runtime). When calling a program, the
User Language Interpreter loads the machine program with the specified name from the
ulcprog.vdb
file of the
Bartels AutoEngineer programs directory. The program's
User Language Compiler version is checked to ensure compatibility with the current
User Language Interpreter version (otherwise the Interpreter might not understand the program structure). The caller type coding stored with the program is used to check whether the index variable types and system functions referenced by the program are implemented in the current
User Language Interpreter environment. During program load, the Interpreter automatically performs all of the required dynamic link processes. The libraries to be linked with the program are checked for compatibility as well.
The machine architecture implemented in the Bartels User Language corresponds to a stack machine. The instruction set of this stack machine contains load commands (for loading variable values and/or constants), ALU commands (for activating the arithmetic-logic unit of the machine), store commands (for assignments), function call commands and stack management commands.
The instruction set of this machine is listed in table 3-1. The stack columns provide information on how many stack arguments are required by each instruction and how the stack size changes when executing the instruction.
Table 3-1: User Language Machine Instruction Set
Instruction | Stack Arguments | Stack Change | Instruction Designator |
---|---|---|---|
nop | 0 | 0 | No operation |
add | 2 | -1 | Add |
addstr | 2 | -1 | Add string |
and | 2 | -1 | And |
bnot | 1 | 0 | Binary not |
cmpeq | 2 | -1 | Compare equal |
cmpge | 2 | -1 | Compare greater equal |
cmpgt | 2 | -1 | Compare greater |
cmple | 2 | -1 | Compare less equal |
cmplt | 2 | -1 | Compare less |
cmpne | 2 | -1 | Compare not equal |
decr | 1 | 0 | Decrement |
div | 2 | -1 | Divide |
divr | 2 | -1 | Divide rest |
incr | 1 | 0 | Increment |
mul | 2 | -1 | Multiply |
neg | 1 | 0 | Negate |
not | 1 | 0 | Not |
or | 2 | -1 | Or |
shl | 2 | -1 | Shift left |
shr | 2 | -1 | Shift right |
sub | 2 | -1 | Subtract |
xor | 2 | -1 | Exclusive or |
cast t | 1 | 0 | Cast value |
castoiv i | 3 | -2 | Cast of index variable |
getary | 2 | -1 | Get array element |
getidx i | 1 | 1 | Get index |
getidxof i | 3 | -1 | Get index of |
loadas s | 1 | 0 | Load stack array element |
loadav v | 1 | 0 | Load variable array element |
loadchr c | 0 | 1 | Load character |
loaddbl d | 0 | 1 | Load double |
loadint i | 0 | 1 | Load integer |
loadiv v | 2 | -1 | Load index variable |
loadoiv v | 4 | -3 | Load of index variable |
loads s | 0 | 1 | Load stack |
loadsd s | 0 | 1 | Load stack destructive |
loadstr s | 0 | 1 | Load string |
loaduref f | 0 | 1 | Load user function reference |
loadv v | 0 | 1 | Load variable |
loadvd v | 0 | 1 | Load variable destructive |
storeas s | 2 | -2 | Store stack array element |
storeav v | 2 | -2 | Store variable array element |
stores s | 1 | -1 | Store stack |
storev v | 1 | -1 | Store variable |
pop s | 0 | 0 | Pop stack |
popt | 1 | -1 | Pop top of stack |
push s | 0 | 0 | Push stack |
swap s | 0 | 0 | Swap stack |
xchg s | 0 | 0 | Exchange stack |
xchgt | 2 | 0 | Exchange top of stack |
jump p | 0 | 0 | Jump always |
jumpeq p | 2 | -1 | Jump if stack tops equal |
jumpnz p | 1 | -1 | Jump if stack nonzero |
jumpz p | 1 | -1 | Jump if stack zero |
calls f | 0 | 1 | Call system function |
callu f | 0 | 1 | Call user function |
hlt | 0 | 0 | Halt program |
ret | 1 | -1 | Return (pop optional stack) |
stop | 0 | 0 | Stop function |
Bartels :: Bartels AutoEngineer :: BAE Documentation :: User Language Programmer's Guide :: Programming System :: Conventions |
Conventions
© 1985-2025 Oliver Bartels F+E