Proteus (programming language)


Proteus is a fully functional, procedural programming language created in 1998 by Simone Zanella. Proteus incorporates many functions derived from several other
languages: C, BASIC, Assembly, Clipper/dBase;
it is especially versatile in dealing with strings, having hundreds of dedicated functions; this makes it one of the richest languages for text manipulation.
Proteus owes its name to a Greek god of the sea, who took care of Neptune's crowd and gave responses; he was renowned for being able to transform himself, assuming different shapes. Transforming data from one form to another is the main usage of this language.

Introduction

Proteus was initially created as a multiplatform system utility, to manipulate text and binary files and to create CGI scripts. The language was later focused on Windows, by
adding hundreds of specialized functions for: network and serial communication, database interrogation, system service creation, console applications, keyboard emulation, ISAPI scripting.
Most of these additional functions are only available in the Windows flavour of the interpreter, even though a Linux
version is still available.
Proteus was designed to be practical, readable and consistent.
Its strongest points are:
The language can be extended by adding user functions written in Proteus or DLLs created in C/C++.

Language features

At first sight, Proteus may appear similar to Basic because of its straight syntax, but similarities are limited
to the surface:
Data types supported by Proteus are only three: integer numbers, floating point numbers and strings.
Access to advanced data structures takes place by
using handles, i.e. integer numbers returned by item creation functions.
Type declaration is unnecessary: variable type is determined by the function applied – Proteus converts on the fly
every variable when needed and holds previous data renderings, to avoid performance degradation caused by
repeated conversions.
There is no need to add parenthesis in expressions to determine the evaluation order, because the language is fully functional.
Proteus includes hundreds of functions for:
Proteus supports associative arrays and AVL trees, which are very useful and powerful to quickly sort
and lookup values.
Two types of regular expressions are supported:
Both types of expressions can be used to parse and compare data.
The functional approach and the extensive library of built-in functions allow to write very short but powerful scripts;
to keep them comprehensible, medium-length keywords were adopted.
The user, besides writing new high-level functions in Proteus, can add new functions in C/C++ by following the
guidelines and using the templates available in the software development kit; the new functions can be invoked
exactly the same way as the predefined ones, passing expressions by value or variables by reference.
Proteus is an interpreted language: programs are loaded into memory, pre-compiled and run; since the number of
built-in functions is large, execution speed is usually very good and often comparable to that of compiled programs.
One of the most interesting features of Proteus is the possibility of running scripts as services or
ISAPI scripts.
Running a Proteus script as a service, started as soon as the operating system has finished loading, gives many
advantages:
This is very useful to protect critical processes in industrial environments,
or to avoid that the operator inadvertently closes a utility.
The ISAPI version of Proteus can be used to create scripts run through Internet Information Services and is
equipped with specific functions to cooperate with the web server.
For intellectual property protection Proteus provides:
Proteus is appreciated because it is relatively easy to write short, powerful and comprehensible scripts;
the large number of built-in functions, together with the examples in the manual, keep low the learning curve.
The development environment includes a source code editor with syntax highlighting and a context-sensitive guide.
Proteus does not need to be installed: the interpreter is a single executable that
does not require additional DLLs to be run on recent Windows systems.

Synopsis and licensing

The main features of this language are:
Proteus is available in demo version and registered version,
protected by a USB dongle. At the moment, is available as a Windows or Ubuntu package and is distributed by
.

Example programs

Hello World

The following example prints out "Hello world!".
CONSOLELN "Hello World!"

Extract two fields

The following example reads the standard input and prints out the first two fields separated by "|":
CONSOLELN TOKEN "|" TOKEN
Proteus scripts by default work on an input file and write to an output file; the predefined identifier L gets the
value of every line in input. The function TOKEN returns the requested item of the string; the third parameter represents
the delimiter. String concatenation is implicit.
The same program can be written in this way:
H = TOKNEW
CONSOLELN TOKGET "|" TOKGET
TOKFREE

In this case, we used another function, which builds the list of the tokens in the line; this is more
efficient if we need to access several items in the string.