Misplaced Pages

Proteus (programming language)

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
The topic of this article may not meet Misplaced Pages's general notability guideline. Please help to demonstrate the notability of the topic by citing reliable secondary sources that are independent of the topic and provide significant coverage of it beyond a mere trivial mention. If notability cannot be shown, the article is likely to be merged, redirected, or deleted.
Find sources: "Proteus" programming language – news · newspapers · books · scholar · JSTOR (May 2023) (Learn how and when to remove this message)
This article needs additional citations for verification. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Proteus" programming language – news · newspapers · books · scholar · JSTOR (November 2024) (Learn how and when to remove this message)
This article relies excessively on references to primary sources. Please improve this article by adding secondary or tertiary sources.
Find sources: "Proteus" programming language – news · newspapers · books · scholar · JSTOR (November 2024) (Learn how and when to remove this message)
This article possibly contains original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed. (April 2024) (Learn how and when to remove this message)
(Learn how and when to remove this message)
Proteus
DeveloperSimone Zanella
First appeared1998
OSUnix, DOS, Microsoft Windows, Linux
Websitehttp://www.szp.co/proteus_eng/
Influenced by
C, BASIC, Assembly, Clipper

Proteus (PROcessor for TExt Easy to USe) 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; and is especially versatile in dealing with strings, having hundreds of dedicated functions, making it one of the richest languages for text manipulation.

Proteus owes its name to a Greek god of the sea (Proteus), 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 (DOS, Windows, Unix) 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 (for IIS). 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 (easy to use, efficient, complete), 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:

  • Proteus has a fully functional, procedural approach;
  • variables are untyped, do not need to be declared, can be local or public and can be passed by value or by reference;
  • all the typical control structures are available (if-then-else; for-next; while-loop; repeat-until; switch-case);
  • new functions can be defined and used as native functions.

Data types supported by Proteus are only three: integer numbers, floating point numbers and strings. Access to advanced data structures (files, arrays, queues, stacks, AVL trees, sets and so on) 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 (there are no operators).

Proteus includes hundreds of functions for:

  • accessing file system;
  • sorting data;
  • manipulating dates and strings;
  • interacting with the user (console functions)
  • calculating logical and mathematical expressions.

Proteus supports associative arrays (called sets) and AVL trees, which are very useful and powerful to quickly sort and lookup values.

Two types of regular expressions are supported:

  • extended (Unix like);
  • basic (Dos like, having just the wildcards "?" and "*").

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:

  • no user needs to log in to start the script;
  • a service can be run with different privileges so that it cannot be stopped by a user.

This is very useful to protect critical processes in industrial environments (data collection, device monitoring), or to avoid that the operator inadvertently closes a utility (keyboard emulation).

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:

  • script encryption;
  • digital signature of the scripts, by using a unique development key;
  • the option to enable or disable the execution of a script (or part of it) by using the key of the customer.

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 (below 400 Kb) that does not require additional DLLs to be run on recent Windows systems.

Synopsis and licensing

The main features of this language are:

  • fully functional, procedural language;
  • no data types: all variables can be used as integer numbers, floating point numbers or strings; variables are interpreted according to the functions being applied – Proteus keeps different representations of their values between calls, to decrease execution time in case of frequent conversions between one type and the other;
  • no pre-allocated structures: all data used by Proteus are dynamically allocated at execution time; there are no limits on: recursion, maximum data size, number of variables, etc.;
  • no operators: As a completely functional language, there are no operators; thus, there is no ambiguity when evaluating expressions and parenthesis are not needed;
  • large library of predefined functions: Proteus is not a toy-language, it comes with hundreds of library functions ready to be used for working on strings, dates, numbers, for sorting, searching and so on;
  • advanced data access (DAO), pipes, Windows sockets, serial ports: in the Windows version, Proteus includes hundreds of system calls which are operating system-specific;
  • clear and comprehensible syntax: the names of the library functions resemble those of corresponding functions in C, Clipper/Flagship and Assembly; by using medium-length keywords, Proteus programs are very easy to understand;
  • native support for high-level data structures: arrays, queues (single or double), stacks, bit maps, sets, AVL trees are already available in Proteus and do not require additional code or libraries to be used;
  • ISAPI DLL and Windows Service versions: Proteus is available as a Windows service or as an ISAPI DLL (for using together with Microsoft Internet Information Server);
  • user libraries: it is possible to write user defined functions (UDF) in separate files, and include them (even conditionally and recursively) inside new programs; UDFs can be referenced before or after the definition; it is also possible to write external functions in Visual C++ and invoke them from a Proteus script;
  • native support for MS-DOS/Windows, Macintosh and Unix text files (all versions);
  • three models for dates (English, American, Japanese), with functions to check them and to do calculations according to Gregorian calendar;
  • epoch setting for 2-digit-year dates;
  • support for time in 12- and 24-hour format;
  • support for simple (Dos-like) and extended (Unix-like) regular expressions, in all versions;
  • intellectual property protection, by using digital signature and cryptography;
  • extensive library of functions to write interactive console programs.

Proteus is available in demo version (script execution limited to three minutes) and registered version, protected by a USB dongle. At the moment, is available as a Windows or Ubuntu package and is distributed by SZP.

Example programs

Hello World

The following example prints out "Hello world!".

CONSOLELN "Hello World!"

Extract two fields

The following example reads the standard input (CSV format, separator ";") and prints out the first two fields separated by "|":

CONSOLELN TOKEN(L, 1, ";") "|" TOKEN(L, 2, ";")

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(L, ";")
CONSOLELN TOKGET(H, 1) "|" TOKGET(H, 2)
TOKFREE(H)

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

References

  1. Karpagam, R.; Sathishkumar, G.K.; Megala, V.; Lydia, J.; Priya, N.; Abhishek Dheeven, T. (2021). "Solid state switching using wireless network in home automation". Materials Today: Proceedings. 46. Elsevier: 4110–4116. doi:10.1016/j.matpr.2021.02.630. eISSN 2214-7853.
  2. ^ "Proteus User Manual". szp.co. Retrieved 13 November 2024.
  3. "Introduction". Zanella HiFi. Retrieved 13 November 2024.
  4. "Library functions: functions on strings". Zanella HiFi. Retrieved 13 November 2024.
  5. ^ "Library functions: date calculations". Zanella HiFi. Retrieved 13 November 2024.
  6. "Library functions: interactive functions (console)". Zanella HiFi. Retrieved 13 November 2024.
  7. "Library functions: logical operations". Zanella HiFi. Retrieved 13 November 2024.
  8. "Library functions: operations on integer and floating point numbers". Zanella HiFi. Retrieved 13 November 2024.
  9. "Library functions: data structures". Zanella HiFi. Retrieved 13 November 2024.
  10. "Proteus Center". Zanella HiFi. Retrieved 13 November 2024.
  11. "Proteus Center: Services". Zanella HiFi. Retrieved 13 November 2024.
  12. ^ "Protecting Proteus programs". Zanella HiFi. Retrieved 13 November 2024.
  13. "Command line". Zanella HiFi. Retrieved 13 November 2024.
  14. "Regular expressions". Zanella HiFi. Retrieved 13 November 2024.
  15. "Methods". szp.co. Retrieved 13 November 2024.

External links

Category: