Home Online Manual
Back: Implemented algorithms
Forward: General command syntax
FastBack: General concepts
FastForward: Input and output
Up: General concepts
Top: Singular Manual
Contents: Table of Contents
Index: Index
About: About this document

3.5 The SINGULAR language

SINGULAR interprets commands given interactively on the command line as well as given in the context of user-defined procedures. In fact, SINGULAR makes no distinction between these two cases. Thus, SINGULAR offers a powerful programming language as well as an easy-to-use command line interface without differences in syntax or semantics.

In the following, the basic language concepts such as commands, expressions, names, objects, etc., are discussed. See Procedures, and Libraries, for the concepts of procedures and libraries.

In many aspects, the SINGULAR language is similar to the C programming language. For a description of some of the subtle differences, see Major differences to the C programming language.

Elements of the language

The major building blocks of the SINGULAR language are expressions, commands, and control structures. The notion of expressions in the SINGULAR and the C programming language are identical, whereas the notion of commands and control structures only roughly corresponds to C statements.

  • An "expression" is a sequence of operators, functions, and operands that specifies a computation. An expression always results in a value of a specific type. See Data types, and its subsections (e.g., poly expressions), for information on how to build expressions.

  • A "command" is either a declaration, an assignment, a call to a function without return value, or a print command. For detailed information, see General command syntax.

  • "Control structures" determine the execution sequence of commands. SINGULAR provides control structures for conditional execution (if ... else) and iteration (for and while). Commands may be grouped in pairs of { } (curly brackets) to form blocks. See Control structures, for more information.

Other notational conventions

For user-defined functions, the notions of "procedure" and "function" are synonymous.

As already mentioned above, functions without return values are called commands. Furthermore, whenever convenient, the term "command" is used for a function, even if it does return a value.

3.5.1 General command syntax  
3.5.2 Special characters  
3.5.3 Names  
3.5.4 Objects  
3.5.5 Type conversion and casting  
3.5.6 Flow control