Seed7
Seed7 | |
---|---|
Paradigms : | Multiparadigms (expandable, object-oriented , imperative , procedurally structured , generic , reflexive ) |
Publishing year: | 2005 |
Developer: | Thomas Mertes |
Current version | 2020-07-27 (July 27, 2020) |
Typing : | static , strong , type-safe |
Important implementations : | Open source reference implementation |
Influenced by: | Pascal , Modula-2 , Ada , Algol 68 , C , C ++ , Java |
Operating system : | platform independent ( Linux , Windows , Mac OS , BSD , Unix ) |
License : | GPL , LGPL (for the runtime library) |
seed7.sourceforge.net |
Seed7 is an extensible programming language that was invented by Thomas Mertes. Syntactically it is similar to Pascal and Ada . In addition to many other properties, there is an extension mechanism that allows the language to be extended with new syntax and the associated semantics and also enables new language constructs to be defined in Seed7. In this way, both syntax and semantics can be defined for new statements and user-defined operator symbols can be introduced. The implementation of Seed7 therefore differs significantly from the implementation of other languages with hard-coded syntax and semantics.
properties
Seed7 supports next to the imperative , object-oriented and generic paradigm technologies such as name parameters (call by name), multi-method (multiple dispatch), function overloading , operator overloading , exception handling , and high-precision arithmetic . The essential properties include:
- custom statements and operators
- abstract data types
- Templates with no special syntax
- OO with interfaces and multiple dispatch
- Static typing
- Can be interpreted or compiled
- Source code portability
- Runs on Linux , Windows , Mac OS , BSD , Unix
Several programming language concepts have been generalized:
- Type declarations (they give a type a name) and function definitions take the form of constant definitions.
- Expressions which to compile time are evaluated, and user-defined functions can access.
- Overloading and object orientation (with multi-methods) have a common concept. They only take place at different times (compilation time or runtime ).
- Type names and type descriptions can be used as parameters and function result.
- Functions that are executed at compile time can be used to declare objects.
- Templates are implemented as compilation time functions with types as parameters.
- Arrays , hash tables, and structs are not hard-coded. Instead, they are defined as an abstract data type in program libraries.
- The parser and interpreter are part of the runtime library.
- The Unicode support is based on UTF-32 . This avoids the problems of variable length encoding such as UTF-16 .
The Seed7 project contains both a compiler and an interpreter , which supports rapid program development. The Seed7 compiler uses the parser and a reflection interface from the runtime library to generate a C program that is then compiled in machine language. Compiled Seed7 programs have a similar runtime to C programs.
Hello World
The following Seed7 source code returns Hello World! out.
$ include "seed7_05.s7i"; const proc: main is func begin writeln("Hallo Welt!"); end func;
Libraries
Seed7 has many libraries that cover different areas:
- Container ,
- numeric functions,
- lexical scanners ,
- File manipulation,
- Networks ( sockets , TLS / SSL , HTTP , HTTPS , FTP , SMTP etc.),
- Graphics ,
- bitmap and vector font ,
- Database access ( MySQL , MariaDB , SQLite , PostgreSQL , Oracle , ODBC , Firebird , InterBase ),
- CGI support,
- Data compression ,
- Character encoding ,
- Processing of date and time,
- XML processing ,
- Cryptological hash functions .
This means that the need for direct operating system calls and external libraries is relatively low, and Seed7 libraries contain abstraction layers for hardware and operating system . This means that practically no changes are necessary if Seed7 programs are ported to other computer architectures or operating systems.
history
Seed7 is based on MASTER, an expandable programming language that was described in Thomas Mertes' thesis and dissertation. Most of MASTER's original ideas such as B. the user-definable instructions and operators can be found in Seed7. It was planned to create a preprocessor for MASTER, but this was ultimately not implemented in the original project. In 1989 the development of an interpreter for MASTER began under the name HAL. In 2005 the MASTER or HAL project was published under the name Seed7 ("open source"). In version 2013-09-08, the Seed7 project contains more than 300,000 program lines and several hundred pages of documentation.
Expandability
Extensibility is based on two parts: a syntax definition, which provides a pattern for a new syntax, and a normal function definition, which is used to define the semantics.
Syntax definition
A syntax definition uses the Seed7 Structured Syntax Description (S7SSD). An S7SSD instruction like
$ syntax expr: .(). + .() is -> 7;
defines the syntax of the +
operator . The right arrow ->
describes the associativity : This +
is a left-associative operator that evaluates from left to right. With 7
which is a priority of the +
operator defined. The syntax pattern .(). + .()
begins with a period ( .
) and is structured by periods. Without dots, the syntax pattern is () + ()
The symbol ()
is a non-terminal symbol and +
is a terminal symbol . The S7SSD does not differentiate between different non-terminal symbols. Instead, there is only one non-terminal symbol: ()
.
Semantic expansion
The definition of the +
complex number operator is a normal function definition :
const func complex: (in complex: summand1) + (in complex: summand2) is func result var complex: sum is complex.value; begin sum.re := summand1.re + summand2.re; sum.im := summand1.im + summand2.im; end func;
further reading
- Jean-Raymond Abrial, Uwe Glässer: Rigorous Methods for Software Construction and Analysis , 1st edition, Springer Berlin Heidelberg, January 20, 2010, ISBN 978-3-642-11446-5 .
Web links
- Seed7 Homepage - Contains FAQ, manual, screenshots, examples, libraries and a collection of algorithms
- Download Seed7 from Sourceforge
- Seed7 at Rosetta Code - Contains many Seed7 examples
- Summary of the thesis by Thomas Mertes
- Summary of Thomas Mertes' dissertation
- Dissertation by Thomas Mertes
- Article by Daniel Zingaro, McMaster University , Hamilton, Ontario, Canada on "Modern Extensible Languages" . ( alternative link ) (paragraph about Seed7 on page 16)
- Book by Abrial, Jean-Raymond and Glässer, Uwe: Rigorous Methods for Software Construction and Analysis (see page 166) (English)
- The Quest for the Ultimate Cycle ( Memento from October 25, 2013 in the Internet Archive ) explores the 3n + C extension of the Collatz problem with Seed7 programs
- Remo Laubacher's blog : Statically linked Linux executables with GCJ, Seed7 and haXe (English)
- Blog of David Gudeman The Seed7 Programming Language (English)
- A FreeBSD port / see also here , maintained by Pietro Cerutti
- An OpenBSD port maintained by Brian Callahan
- A Seed7 package for openSUSE / Fedora
Individual evidence
- ↑ sourceforge.net .
- ^ A b Zingaro, Daniel, "Modern Extensible Languages", SQRL Report 47 McMaster University (October 2007), page 16.
- ↑ Abrial, Jean-Raymond and Glässer, Uwe, "Rigorous Methods for Software Construction and Analysis", ISBN 978-3-642-11446-5 , Springer, 2010, page 166.
- ^ Seed7 libraries
- ↑ Mertes, Thomas, "Design of an expandable higher programming language", diploma thesis, Vienna University of Technology (1984).
- ^ Mertes, Thomas, "Definition of an expandable higher programming language", dissertation Technical University of Vienna (1986).