Sather

Source: Wikipedia, the free encyclopedia.
Sather
GNU project
First appeared1990
Stable release
1.2.3[1]
/ 7 July 2007; 16 years ago (7 July 2007)
strong
Websitewww.gnu.org/software/sather/
Major implementations
ICSI Sather, GNU Sather
Influenced by
Eiffel, CLU, Common Lisp, Scheme
Influenced
Cool

Sather is an

subtypes
.

Originally, it was based on Eiffel, but it has diverged, and now includes several functional programming features.

The name is inspired by Eiffel; the

Jane Krom Sather, the widow of Peder Sather
, who donated large sums to the foundation of the university.

Sather also takes inspiration from other programming languages and paradigms:

type system.

The original Berkeley implementation (last stable version 1.1 was released in 1995, no longer maintained

University of Karlsruhe;[4][5] Sather-W from the University of Waikato[6] (implementation of Sather version 1.3); Peter Naulls' port of ICSI Sather 1.1 to RISC OS;[7] and pSather,[8][9] a parallel version of ICSI Sather addressing non-uniform memory access
multiprocessor architectures but presenting a shared memory model to the programmer.

The former ICSI Sather compiler (now GNU Sather) is implemented as a compiler to

intermediate language
. Optimizing is left to the C compiler.

The GNU Sather compiler, written in Sather itself, is

LGPL
.

Hello World

 class HELLO_WORLD is
  main is 
   #OUT+"Hello World\n"; 
  end; 
 end;

A few remarks:

Example of iterators

This program prints numbers from 1 to 10.

 class MAIN is
   main is
     loop
      i := 1.upto!(10);
      #OUT + i + "\n";
     end;
   end;
 end;

The loop ... end construct is the preferred means of defining loops, although while and repeat-until are also available. Within the construct, one or more iterators may be used. Iterator names always end with an exclamation mark. (This convention is enforced by the compiler.) upto! is a method of the INT class accepting one once argument, meaning its value won't change as the iterator yields. upto! could be implemented in the INT class with code similar to the following one.

  upto!(once m:INT):SAME is
    i: INT := self; -- initialise i to the value of self, 
                    -- that is the integer of which this method is called
    loop
      if i>m then 
        quit;  -- leave the loop when i goes beyond m
      end;
      yield i; -- else use i as return value and stay in the loop
      i := i + 1; -- and increment
    end;
  end;

Type information for variables is denoted by the postfix syntax variable:CLASS. The type can often be inferred and thus the typing information is optional, as in anInteger::=1. SAME is a pseudo-class referring to the current class.

References

  1. ^ Error: Unable to display the reference properly. See the documentation for details.
  2. ^ "ICSI Sather future plans".
  3. ^ "GNU Sather downloads".
  4. ^ Sather-K project page (archive from year 2001)
  5. ^ "Sather-K 0.9 download, version from year 1994".
  6. ^ Sather-W 1.3 project page (archived link from year 2002)
  7. ^ Peter Naulls' port is no longer available on the Web.
  8. ^ "pSather description".
  9. ^ "pSather download". Archived from the original on 2017-07-06. Retrieved 2021-10-11.{{cite web}}: CS1 maint: bot: original URL status unknown (link)

External links

This page is based on the copyrighted Wikipedia article: Sather. Articles is available under the CC BY-SA 3.0 license; additional terms may apply.Privacy Policy