t3x.org / t3x / t3x-manual / 1.html
 
T3X - A Minimum Procedural Language
Version 8.1.5, Online Edition
Copyright(C) 1996-2004
Nils M Holm
 
Previous:
-/-
TOC | Index | Back Next:
1.1 The History of T3X

1. Introduction

T3X is a small, portable, procedural, block-structured, recursive, almost typeless, and to some degree object oriented language. Its syntax is derived from Pascal and BCPL and its object model is similar to that of Java, but much simpler. The structured approach to programming is well-understood, provides a sufficient degree of abstraction, and can easily be translated into native machine code at the same time. The object model eases the development of general and resusable code. T3X is an imperative language. This means that a program consists of a set of instructions which tell the computer in what way to manipulate the data defined by the program. An instruction is also called a statement. In structured programming languages, there are four fundamental ways of formulating statements:

The assignment is a fundamental property of imperative languages. It is used to move data from one location to another by assigning values to variables. In a sequence - which is basically a list of statements - the statements are processed from the top towards the bottom of the list. The execution of one statement is guaranteed to be completed before the next one is interpreted. A branch is a statement which is executed only if an associated condition applies. Iteration is the repetition of a statement depending on a condition. In a block-structured language, statements may be grouped in statement blocks or compound statements. Each block may have its own local data which cannot be affected by statements contained in other blocks.

An additional layer of abstraction is added to an imperative, block-structured language by providing user-defined procedures or functions (in this document, these terms will be used synonymously). A procedure is a statement or a set of statements which is bound to a symbolic name. A procedure can be executed by coding a call to that procedure. Most languages provide a mechanism to transport data to a procedure and return a value to the calling program. Some languages (like BCPL and Pascal) make a distinction between procedures and functions, others (like K&R C) do not. In languages which make a distinction between procedures and functions, only functions may return values. In T3X, all procedures return values, but the caller is free to ignore them. Therefore, procedures and functions are basically the same.

Another level of abstraction is provided by adding an object model to the language. The object model of T3X consists solely of

Classes are used to encapsulate code and data of a program. A class may contain any number of data objects and procedures. Only public procedures (so-called methods) may be called by procedures (or methods) of other classes. Objects are used to instantiate classes. Each instance of a class has its own private data area. Hence the same class may be used as a template for creating multiple independent objects. Messages are used to activate methods of specific objects. T3X does not provide inheritance nor does it support different protection levels (like public data or 'friend' relationships), because these concepts undermine the object oriented model.

T3X is an almost typeless language. There exist two different types, so-called atomic variables which may hold small data objects, like characters, numbers and references to other data objects, and vectors which are used to store logically connected groups of small data objects. Additionally, there are constants, templates for defining structured data objects and classes, and different types of procedure declarations. The T3X compiler does not allow some combinations of operators which do not make sense (like assigning a value to a procedure or sending a message to a vector). Consequently, T3X's type checking is much more strict than for example BCPLs, but much less restrictive than Pascals. Weakly typed and typeless languages have been exposed to a lot of critique in the past, because they are considered `insecure', but the degree of simplicity and flexibility which is bought by 'sacrificing' this bit of security is immense.

The type checking mechanisms of the T3X language are limited to the detection of

BTW: during the development of an early version of T3X, a severe error occurred in the compiler. After tracking it down, it turned out that was limited to the (type-safe) ANSI C version of the translator and did not affect the T3X version. Of course, this was coincidence, but to some degree it weakens the proposition that typeless languages are per se insecure and dangerous.

Previous:
-/-
TOC | Index | Back Next:
1.1 The History of T3X