Sather - Language Specification

David Stoutamire

Stephen Omohundro

Re-edited by Norbert Nemec

Copyright © 199x by International Computer Science Institute

Copyright © 1999 by Free Software Fondation Inc.

This file is part of the GNU Sather package. It is free software; you may redistribute and/or modify it under the terms of the GNU General Public License (GPL) as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version. *** This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See Doc/GPL for more details. *** The license text is also available from: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA


Table of Contents
I. The Sather Specification
1. Introduction
1.1. About This Document
1.2. Basic Concepts
2. Lexical Structure
3. Types and Classes
3.1. Type specifiers
3.2. Signatures
3.3. Sather source files
3.4. Abstract classes
3.5. Concrete classes
3.6. Parameterization
4. Class Elements
4.1. Constant definitions
4.2. Shared attribute definitions
4.3. Attribute definitions
4.4. Routine definitions
4.5. Iterator definitions
4.6. Code inclusion and include clauses
4.7. Stubs
5. Basic Statements
5.1. Declaration statements
5.2. Assignment statements
5.3. if statements
5.4. return statements
5.5. case statements
5.6. typecase statements
5.7. Expression statements
6. Literal Expressions
6.1. Boolean literal expressions
6.2. Character literal expressions
6.3. String literal expressions
6.4. Integer literal expressions
6.5. Floating point literal expressions
7. Basic Expressions
7.1. self expressions
7.2. Local variable access expressions
7.3. Method call expressions
7.4. void expressions
7.5. void test expressions
7.6. new expressions
7.7. Creation expressions
7.8. Array creation expressions
7.9. and expressions
7.10. or expressions
7.11. Syntactic sugar expressions
8. Loops and Iterators
8.1. loop statements
8.2. yield statements
8.3. quit statements
8.4. while! expressions
8.5. until! expressions
8.6. break! expressions
9. Closures
9.1. Closure creation expressions
9.2. Closure calls
10. Exceptions
10.1. protect statements
10.2. raise statements
10.3. exception expressions
11. Safety Features
11.1. Pre- and post-conditions
11.2. assert statements
11.3. initial expressions
11.4. result expressions
12. Special feature names
12.1. invariant
12.2. main
13. Built-in classes
14. Conventions
14.1. Object Creation
14.2. Naming
14.3. Object Identity
14.4. Nil and void
14.5. IEEE Floating-Point
II. Sather 1.1 Extensions
15. Language Interface Extensions
15.1. Interfacing with Fortran
15.2. Interfacing with ANSI C
16. Threaded Extension
16.1. par and fork statements
16.2. parloop statement
17. Synchronization Extension
17.1. lock statement
17.2. unlock statement
17.3. $LOCK classes
17.4. Attach statement
17.5. $ATTACH classes
17.6. sync statement
17.7. Memory consistency
17.8. SYS class
18. Distributed Extension
18.1. The '@' operator
18.2. Location expressions
18.3. with-near statement