This article relies too much on references to primary sources. (September 2018) (Learn how and when to remove this template message)
Seed7 is an extensible general-purpose programming language designed by Thomas Mertes. It is syntactically similar to Pascal and Ada. Along with many other features, it provides an extension mechanism. Seed7 supports introducing new syntax elements and their semantics into the language, and allows new language constructs to be defined and written in Seed7. For example, programmers can introduce syntax and semantics of new statements and user defined operator symbols. The implementation of Seed7 differs significantly from that of languages with hard-coded syntax and semantics.
|Paradigm||multi-paradigm: extensible, object-oriented, imperative, structured, generic, reflective|
|Designed by||Thomas Mertes|
2018-08-21 / August 21, 2018
|Typing discipline||static, strong, safe, nominative, manifest|
|OS||Cross-platform: BSD, Linux, OS X, Unix, Windows|
|License||GPL, LGPL (for the runtime library)|
|Filename extensions||.sd7, .s7i|
|open source reference implementation|
|Pascal, Modula-2, Ada, ALGOL 68, C, C++, Java|
Seed7 supports the programming paradigms: imperative, object-oriented (OO), and generic. It also supports features such as call by name, multiple dispatch, function overloading, operator overloading, exception handling and arbitrary-precision arithmetic.
Major features include:
- User defined statements and operators
- Abstract data types
- Templates without special syntax
- Object-oriented with interfaces and multiple dispatch
- Static typing
- May be interpreted or compiled
- Source code portability
- Runs under BSD, Linux, Mac OS X, Unix, Windows
Several programming language concepts are generalized:
- Type declarations (which assign a name to a type) and function definitions take the form of constant definitions.
- Compile time expressions can execute user-defined functions.
- Overloading and object-orientation (with multiple dispatch) are seen as common concepts. They just happen at different times: compile time and run time, respectively.
- Type names and type descriptions can be used as parameter and function result.
- Functions, which are executed at compile time, can be used to define objects.
- Templates are written as compile time functions with type parameters.
- Arrays, hash maps and structs are not a hard-coded feature. Instead they are defined as abstract data type in libraries.
- Parser and interpreter are part of the runtime library.
- UTF-32 Unicode support.
The Seed7 project includes both an interpreter and a compiler. The interpreter starts programs very quickly, supporting fast program development. The compiler uses the parser and reflection interfaces from the run-time library to generate a C program, which is subsequently compiled to machine code. Compiled Seed7 programs can have comparable performance to C programs.
Seed7 has many libraries, covering areas including containers, numeric functions, lexical analysis, file manipulation, networking (sockets, Transport Layer Security (TLS/SSL), Hypertext Transfer Protocol (HTTP), HTTP Secure (HTTPS), File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), etc.), graphics, pixmap and vector fonts, database access (MySQL-MariaDB, SQLite, PostgreSQL, Oracle, Open Database Connectivity (ODBC)), Common Gateway Interface (CGI) support, data compression, character encoding, time and date handling, XML processing, message digests and more. Seed7 libraries contain abstraction layers for hardware, operating system and third-party libraries, e.g. graphic and database libraries. In other words, no changes are needed to move Seed7 programs between different processors or operating systems.
Seed7 is based on MASTER, an extensible programming language described in the diploma and doctoral theses of Thomas Mertes. Most of the original ideas of MASTER, such as user defined statements and operators, can be found in Seed7. A precompiler, to translate MASTER to Pascal, was proposed, but unimplemented, in the original project. In 1989, development began on an interpreter for MASTER, named HAL. In 2005, the MASTER and HAL projects were released as open source under the Seed7 project name. Since then new versions have been released every two or three weeks. As of version 2013-09-08 the Seed7 project contains more than 300,000 source lines of code and several hundred pages of documentation.
An extension includes two parts: a syntax definition, giving a template for the new syntactic form, and a standard Seed7 function, used to define the semantics.
The syntax definition uses the Seed7 Structured Syntax Description (S7SSD). A S7SSD statement like
$ syntax expr: .(). + .() is -> 7;
specifies the syntax of the
+ operator. The right arrow
-> describes the associativity: Binding of operands from left to right. With
7 the priority of the
+ operator is defined. The syntax pattern
.(). + .() is introduced and delimited with dots (
.). Without dots the pattern is
() + (). The symbol
() is a nonterminal symbol and
+ is a terminal symbol. The S7SSD does not distinguish between different nonterminal symbols. Instead it only knows one nonterminal symbol:
The definition of the
+ operator for complex numbers is just a 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;
- Mertes, Thomas (21 August 2018). "New Seed7 Release 2018-08-21". Retrieved 26 August 2018 – via SourceForge.
- Daniel Zingaro, "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, "Entwurf einer erweiterbaren höheren Programmiersprache", Diploma thesis Vienna University of Technology (1984).
- Mertes, Thomas, "Definition einer erweiterbaren höheren Programmiersprache", Doctoral thesis Vienna University of Technology (1986).
- Seed7 at Rosetta Code - Contains many Seed7 examples
- Abstract of diploma thesis from Thomas Mertes in german
- Abstract of doctoral thesis from Thomas Mertes in german
- Doctorate thesis from Thomas Mertes in german
- Article from Daniel Zingaro, McMaster University, Hamilton, Ontario, Canada about "Modern Extensible Languages". (alternate link) (paragraph about Seed7 at page 16)
- Book from Abrial, Jean-Raymond and Glässer, Uwe: Rigorous Methods for Software Construction and Analysis (see page 166)
- The Quest for the Ultimate Cycle explores the 3n+C extension of the Collatz Conjecture with Seed7 programs
- Blog by Remo Laubacher: Statically linked Linux executables with GCJ, Seed7 and haXe (2011)
- Blog by David Gudeman The Seed7 Programming Language (2015)
- A FreeBSD port / see also here, maintained by Pietro Cerutti
- An OpenBSD port, provided by Brian Callahan
- A discussion where Seed7 is described as language where new syntax can actually be defined by language users