1.2.1 Bartels User Language Compared to C
Bartels User Language source file format is based on the C programming language. As with C and/or C++, comments are enclosed with
/* at the beginning and
*/ at the end or can start with
// and are delimited by the end of the line.
Bartels User Language supports the basic data types
double. The C basic data type
float as well as pointers and the possibility of qualifying basic data types
long) are not supported by
Bartels User Language. The
User Language basic data type
string can be used for representing
char arrays. Another extension to C is the
User Language basic data type
index, which provides access to the
Bartels AutoEngineer Design Database (DDB) via predefined index types. Thereby
index can be understood as index to a vector of DDB structures. A special operator is available for accessing the index-addressed structure elements. The
index types and the corresponding structure elements are predefined (see
User Language provides dynamic array memory management. This means, that there is no need to define array length limits.
Bartels User Language even allows for direct assignments of type compatible complex data types (structures, arrays) with equal dimensions.
Bartels User Language does not support explicit declaration of storage classes
register. Variables defined in functions (local variables) are supposed to be of storage class
auto and those defined outside any function (global variables) are supposed to be global unless they are explicitly declared
static. Functions defined in the program text are assumed to be global, unless they are explicitly defined
static. The scope of global variables and functions covers the whole program, whilst
static variables and functions are valid only in the currently compiled program text (but not in any other program or library module yet to be linked with the program).
Bartels User Language provides a macro preprocessor to support language expansion mechanisms. As with C, the preprocessor statements
#endif are available.
1.2.2 Data Types, Constants, Variables
Bartels User Language provides the basic data types
int (numeric integer value),
double (double precision numeric real value),
string (character array) and
index (predefined index to DDB structure; see
appendix B). Moreover complex composed data type definitions (vectors and/or array as well as structures) can be derived from basic data types.
Basic data types can be represented by constants.
char constants must be delimited by single quotes.
string constants must be delimited by double quotes. Special characters in
string constants must be prefixed by the backslash escape character
\). Integer constants
int) can be specified in decimal (base 10), octal (base 8) or hexadecimal (base 16) representation. Numeric real constants
double) can be specified either in fixed floating point representation or in scientific floating point representation (with exponent).
Constant expressions are composed of constants and operators. Constant expressions are evaluated by the
Bartels User Language Compiler during the translation process (CEE - Constant Expression Evaluation).
All variables must be declared before use. A variable declaration determines the name and the data type of the variable. Variable names (identifiers) must start either with a letter or an underscore
_) and can then have letters, digits or underscores in accordance with the C standard. The
Bartels User Language Compiler distinguishes between lower and upper case letters. Variable declarations can contain variable value initializations. The
User Language Compiler issues warning messages when accessing variables which have not been initialized, and the
User Language Interpreter assigns type compatible null values to such variables.
1.2.3 Operators, Assignments
Bartels User Language supports all the C-known operators
~). The operator evaluation sequence and priority correspond to the C programming language. Operands of different data types are automatically casted to a common and/or operator-compatible data type if possible (the
User Language Compiler issues an error message if this is not possible). The add operator
+) and the comparison operators
!=) can operate directly on the
string data type.
Assignments usually are performed with the general assignment operator
=). The expression value on the right side of the equal sign is assigned to the variable on the left side.
Bartels User Language also provides the composed assignment operators as known from C
1.2.4 Control Structures
The sequence of the instructions to be executed by a program is determined by control structures.
Bartels User Language provides all C-known control structures except for the
goto statement and the definition of labels. I.e., the available
Bartels User Language control structures are
continue. A special
User Language control structure is introduced by the
forall statement which provides a scan of the specified
index data type and can be conditional.
1.2.5 Program Flow, Functions
Usually, a function is defined for solving a certain sub-problem derived from different tasks. Using functions can simplify the process of software maintenance considerably.
Bartels User Language provides a function library containing a predefined set of system functions (see
appendix C). Beyond that the programmer can write his own functions (user functions). The definition and declaration of the user functions and their parameters correspond to the C programming language. The first user function to be called by the
Bartels User Language Interpreter when running a program is the one named
User Language program not containing a
main function usually won't do anything at all.
Bartels User Language does not distinguish between "call-by-value" and "call-by-reference" when passing function parameters. All function parameters are evaluated using the "call-by-reference" method. Therefore no pointers are required for passing changed parameter values back to the caller of a function.
1.2.6 Special In-Build Features
Bartels User Language provides some powerful in-build features worthwhile to be mentioned here especially.
A BNF precompiler is integrated to the
Bartels User Language. This BNF precompiler with its corresponding scanner and parser functions can be utilized to implement programs for processing almost any foreign ASCII file data format. See section
2.6.4 for a detailed description of the BNF precompiler facilities.
Bartels User Language provides SQL (Structured Query Language) functions for maintaining relational databases, thus introducing powerful software tools for programming database management systems. These tools e.g., can be utilized for integrating a component database to the
Bartels AutoEngineer for performing stock and cost expenditure analysis on different variants of a layout including facilities for choosing components with controlled case selection and part value assignment. This is just one example from the wide range of possible database applications. Utilizing database systems could also be worthwhile in the fields of project and version management, address list maintenance, production planning and inventory control, supplier and customer registers management, etc. See
appendix C of this documentation for the descriptions of the SQL system functions.
Characteristics of the Bartels User Language • © 1985-2020 Oliver Bartels F+E • Updated: 04 April 2011, 11:03 [UTC]