ArticleslgStudy

computer science

Seed7

Seed7 is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Seed7 rather than just read about it. In short: Seed7 is an extensible general-purpose programming language designed by Thomas Mertes. It is syntactically similar to Pascal and Ada.

Key takeaways

  • Seed7 belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Seed7 to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Seed7 from memory before moving on to harder problems.

Reference excerpt

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.

Features 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 via supplied libraries that provide a common interface to different operating systems and windowing systems. Runs under BSD, Linux, macOS, 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. This avoids problems of variable-length encodings like UTF-8 and UTF-16. 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.

Features omitted Macros and a preprocessor Modules and namespaces Manual memory management Pointers and NULL Regular expressions Default function parameters

Libraries 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 independent API, Common Gateway Interface (CGI) support, data compression, archive files (tar, zip, cpio, ar, rpm), character encoding, time and date handling, XML processing, message digests and more. These libraries reduce the need to use unportable operating system features and third-party libraries (which might not always be present) directly. 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.

TLS library Seed7 has its own implementation of Transport Layer Security. The library includes AES and elliptic-curve cryptography.

Database abstraction API Seed7 provides a library with a database independent API. Programs can connect to MySQL, MariaDB, SQLite, PostgreSQL, Oracle, Open Database Connectivity (ODBC), Firebird, InterBase, IBM Db2 and SQL Server databases. 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 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 2021-04-25 the Seed7 project contains more than 500,000 source lines of code and 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".

Extension mechanism 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.

Syntax definition 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: ().

Semantic extension The definition of the + operator for complex numbers is just a function definition:

References

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Seed7

Start with the simplest possible case. Write down what Seed7 claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Seed7 before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Seed7 ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Seed7

In research
Seed7 appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Seed7 in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Seed7 is common in secondary-school and first-year university syllabi. It links to neighbouring topics Cross-platform software, Extensible syntax programming languages, Free and open source compilers, so understanding it makes those chapters shorter.
In everyday life
Look for Seed7 outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Seed7” →

How to study Seed7 in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Seed7 means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Seed7 out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Seed7 in simple terms?

Seed7 is an extensible general-purpose programming language designed by Thomas Mertes. It is syntactically similar to Pascal and Ada.

Why does Seed7 matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Seed7?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Seed7.

Tags

  • Cross-platform software
  • Extensible syntax programming languages
  • Free and open source compilers
  • Free and open source interpreters
  • Free software programmed in C
  • Multi-paradigm programming languages
  • Object-oriented programming languages
  • Programming languages created in 2005
  • Software using the GNU General Public License
  • Statically typed programming languages

Keep exploring