Seed7
Paradigm | multi-paradigm:extensible,object-oriented,imperative,structured,generic,reflective |
---|---|
Designed by | Thomas Mertes |
First appeared | 2005 |
Stable release | 2024-08-12
/ 16 days ago[1] |
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 |
Website | seed7 |
Majorimplementations | |
open sourcereference implementation | |
Influenced by | |
Pascal,Modula-2,Ada,ALGOL 68,C,C++,Java |
Seed7is anextensiblegeneral-purpose programming languagedesigned by Thomas Mertes. It is syntactically similar toPascalandAda.Along with many other features, it provides an extension mechanism.[2]Seed7 supports introducing new syntax elements and their semantics into the language, and allows new language constructs to be defined and written in Seed7.[3]For example, programmers can introduce syntax and semantics of newstatementsand user definedoperatorsymbols. The implementation of Seed7 differs significantly from that of languages withhard-codedsyntax and semantics.
Features
[edit]Seed7 supports theprogramming paradigms:imperative,object-oriented(OO), andgeneric.It also supports features such ascall by name,multiple dispatch,function overloading,operator overloading,exception handlingandarbitrary-precision arithmetic.
Major features include:
- User defined statements and operators
- Abstract data types
- Templates without special syntax
- Object-oriented withinterfacesand multiple dispatch
- Static typing
- May be interpreted or compiled
- Source codeportabilityvia supplied libraries that provide a common interface to different operating systems and windowing systems.
- Runs underBSD,Linux,MacOS X,Unix,Windows
Several programming language concepts are generalized:
- Type declarations(which assign a name to a type) andfunctiondefinitions take the form of constant definitions.
- Compile-time expressionscan execute user-defined functions.
- Overloading and object-orientation (with multiple dispatch) are seen as common concepts. They just happen at different times:compile timeandrun time,respectively.
- Type names andtype descriptionscan be used asparameterand function result.
- Functions, which are executed atcompile time,can be used to define objects.
- Templatesare written as compile time functions with type parameters.
- Arrays,hash mapsandstructsare not a hard-coded feature. Instead they are defined as abstract data type inlibraries.
- Parserand interpreter are part of the runtime library.
- UTF-32Unicode support. This avoids problems ofvariable-lengthencodings likeUTF-8andUTF-16.
The Seed7 project includes both aninterpreterand acompiler.The interpreter starts programs very quickly, supporting fast program development. The compiler uses the parser andreflectioninterfaces from the run-time library to generate aCprogram, which is subsequently compiled tomachine code.Compiled Seed7 programs can have comparableperformanceto C programs.[4]
Features omitted
[edit]- Macros and a preprocessor
- Modules and namespaces
- Manual memory management
- Pointers and NULL
- Regular expressions
- Default function parameters
Libraries
[edit]Seed7 has many libraries, covering areas includingcontainers,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 vectorfonts,database independent API,Common Gateway Interface(CGI) support,data compression,archive files(tar,zip,cpio,ar,rpm),character encoding,time and date handling,XMLprocessing,message digestsand more.[5]These libraries reduce the need to useunportableoperating system features and third-party libraries (which might not always be present) directly. Seed7 libraries contain abstraction layers forhardware,operating systemand third-party libraries, e.g. graphic and database libraries. In other words, no changes are needed to move Seed7 programs between differentprocessorsoroperating systems.
TLS library
[edit]Seed7 has its own implementation ofTransport Layer Security.[6]The library includesAESandelliptic-curve cryptography.
Database abstraction API
[edit]Seed7 provides a library with adatabaseindependent API.[7]Programs can connect toMySQL,MariaDB,SQLite,PostgreSQL,Oracle,Open Database Connectivity(ODBC),Firebird,InterBase,IBM Db2andSQL Serverdatabases. Independent from the database prepared statements can be created, bind variables can be used, the statements can be executed and result sets can be fetched.
History
[edit]Seed7 is based on MASTER, an extensible programming language described in the diploma and doctoral theses of Thomas Mertes.[8][9]Most of the original ideas of MASTER, such as user defined statements and operators, can be found in Seed7. Aprecompiler,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 2021-04-25 the Seed7 project contains more than 500,000source lines of codeand several hundred pages of documentation.
Mertes has said that the name Seed7 came from the concept of his ideas for the language being spread as seeds that would grow as others used it. The "7" part was added because it was a prime number that he felt sounded good with "seed".[10]
Extension mechanism
[edit]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.[2]
Syntax definition
[edit]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 theassociativity:Binding of operands from left to right. With7
thepriorityof 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.[11]The S7SSD does not distinguish between differentnonterminal symbols.Instead it only knows one nonterminal symbol:()
.
Semantic extension
[edit]The definition of the+
operator for complex numbers is just a function definition:
constfunccomplex:(incomplex:summand1)+(incomplex:summand2)isfunc
result
varcomplex:sumiscomplex.value;
begin
sum.re:=summand1.re+summand2.re;
sum.im:=summand1.im+summand2.im;
endfunc;
References
[edit]- ^Mertes, Thomas (12 August 2024)."New Seed7 Release 2024-08-12".Retrieved16 August2024– viaSourceForge.
- ^abDaniel Zingaro,"Modern Extensible Languages",SQRL Report 47McMaster University(October 2007), page 16 (alternate link).
- ^Abrial, Jean-Raymondand Glässer, Uwe,"Rigorous Methods for Software Construction and Analysis",ISBN978-3-642-11446-5,Springer, 2010, page 166.
- ^Stadfeld, Paul (1 April 2010)."The Quest for the Ultimate Cycle (includes a performance comparison between Python, Seed7 and C)".Archived fromthe originalon 25 October 2013.Retrieved19 August2019.
- ^Seed7 libraries
- ^A Transport Layer Security (TLS) library written in Seed7
- ^Database abstraction API
- ^Mertes, Thomas, "Entwurf einer erweiterbaren höheren Programmiersprache", Diploma thesis Vienna University of Technology (1984).(Abstract)
- ^Mertes, Thomas,"Definition einer erweiterbaren höheren Programmiersprache",Doctoral thesis Vienna University of Technology (1986).(Abstract)
- ^"Coding Club: Presents - Seed7".YouTube.July 4, 2024.RetrievedJuly 22,2024.
- ^David Gudeman (March 26, 2015), "The Seed7 Programming Language" (In Seed7 you can specify a syntax like this)
External links
[edit]- Official website- Homepage with FAQ, manual, screenshots, examples, library descriptions, benchmarks and a set of algorithms
- Mirror of the Seed7 Homepage
- Seed7 at GitHub
- Download Seed7from its main repository at SourceForge
- Seed7 at Rosetta Code- Contains many Seed7 examples
- The Quest for the Ultimate Cycleexplores the 3n+C extension of the Collatz Conjecture with Seed7 programs
- Blog byRemo Laubacher:Statically linked Linux executables with GCJ, Seed7 and haXe(2011)
- Blog byDavid GudemanThe Seed7 Programming Language(2015)
- A FreeBSD port/see also here,maintained byPietro Cerutti
- An OpenBSD port,provided by Brian Callahan
- A Seed7 package for openSUSE/Fedora,(see alsohereorhere)
- A discussion where Seed7 is described as language where new syntax can actually be defined by language users
- Seed7 at "Fossies" - the Fresh Open Source Software Archive
- Multi-paradigm programming languages
- Statically typed programming languages
- Object-oriented programming languages
- Cross-platform software
- Extensible syntax programming languages
- Free software programmed in C
- Free compilers and interpreters
- Programming languages created in 2005
- Software using the GPL license