|  | Annex B: |  | 
 
This Annex contains all of the concrete syntax of the Sather language as given in the various sections of the language specification.
The reference form of the xxx_SY tokens for the purposes of program example text is given in Annex D.
| source text = class specification, {Semicolon_SY, class specification} ; | 
| class specification = | [library signifier], | 
| (abstract class definition | class) ; | 
| library signifier = | Library_SY, identifier ; | 
| abstract class definition = | Abstract_SY, Class_SY, abstract type name, | 
| [generic arguments], | |
| [subtyping clause], | |
| [supertyping clause], Is_SY, | |
| [abstract signature], {Semicolon_SY, [abstract signature]}, End_SY ; | 
| class = | [class type], Class_SY, concrete type name, [generic arguments], | 
| [subtyping clause], Is_SY, | |
| [class element], {Semicolon_SY, [class element]}, End_SY ; | 
| class type = Immutable_SY | Partial_SY | (External_SY, [identifier]) ; | 
| generic arguments = | Left_Brace_SY, parameter declaration, | 
| {Comma_SY, parameter declaration}, Right_Brace_SY ; | 
| subtyping clause = Left_Angle_Bracket_SY, type specifier list ; | 
| supertyping clause = Right_Angle_Bracket_SY, type specifier list ; | 
| parameter declaration = | type name, [Left_Angle_Bracket_SY, type specifier] ; | 
| abstract signature = abstract routine signature | abstract iter signature ; | 
| identifier list = identifier, {Comma_SY, identifier} ; | 
| return signature = Colon_SY, type specifier ; | 
| abstract routine signature = | identifier, [routine parameter pack], [return signature] ; | 
| routine parameter pack = | Left_Parenthesis_SY, | 
| routine argument list, Right_Parenthesis_SY ; | 
| routine argument list = routine argument, {Comma_Sy, routine argument} ; | 
| routine argument = routine mode, identifier list, return signature ; | 
| routine mode = [(Out_SY | Inout_SY)] ; | 
| abstract iter signature = | iter name, [iter parameter pack], [return signature] ; | 
| iter parameter pack = | Left_Parenthesis_SY, | 
| iter argument list, Right_Parenthesis_SY ; | 
| iter argument list = iter argument, {Comma_Sy, iter argument} ; | 
| iter argument = iter mode, identifier list, return signature ; | 
| iter mode = [(Out_SY | Inout_SY | Once_SY)] ; | 
| type specifier list = type specifier, {Comma_SY, type specifier} ; | 
| type specifier = | (type name, [{type specifier list}]) | 
| | method closure type specifier | |
| | Same_Type_SY ; | 
| method closure type specifier = | routine closure type specifier | 
| | iter closure type specifier ; | 
| routine closure type specifier = | Routine_SY, | 
| [{routine mode, type specifier, | |
| {Comma_SY, routine mode, type specifier}}], | |
| [return signature] ; | 
| iter closure type specifier = | Iter_SY, | 
| [{iter mode, type specifier, | |
| {Comma_SY, iter mode, type specifier}}], | |
| [return signature] ; | 
| class element = | constant definition | 
| | shared definition | |
| | attribute definition | |
| | routine definition | |
| | iter definition | |
| | include clause | |
| | stub ; | 
| constant definition = | [Private_SY], Constant_SY, | 
| (simple value | enumerated constants) ; | 
| simple value = identifier, return signature, initialise ; | 
| enumerated constants = | identifier, [initialise], | 
| [Comma_SY,identifier list] ; | 
| initialise = assign op, expression ; | 
| shared definition = | [Private_SY | Readonly_SY], Shared_SY, | 
| (simple value | declaration) ; | 
| attribute definition = | [Private_SY | Readonly_SY], Attr_SY, | 
| declaration ; | 
| routine definition = | [Private_SY], identifier, [routine parameter pack], | 
| [return signature], | |
| [pre-condition], | |
| [post-condition], | |
| [method body] ; | 
| pre-condition = Pre_SY, expression ; | 
| post-condition = Post_SY, expression ; | 
| method body = Is_SY, statement list, End_SY ; | 
| iter definition = | [Private_SY], iter name, [iter parameter pack], | 
| [return signature], | |
| [pre-condition], | |
| [post-condition], | |
| [method body] ; | 
| include clause = | [Private_SY], Include_SY, | 
| (library include | class include), | |
| [feature modifier list] ; | 
| library include = Library_SY, identifier ; | 
| class include = type specifier ; | 
| feature modifier list = | feature modifier, | 
| {Comma_SY, feature modifier} ; | 
| feature modifier = | (identifier | iter name), Rename_SY, | 
| [Private_SY | Readonly_SY], | |
| [(identifier | iter name)] ; | 
| stub = Stub_SY, abstract signature ; | 
| statement list = [statement], {Semicolon_SY, [statement]} ; | 
| statement = | declaration statement | 
| | assign statement | |
| | if statement | |
| | return statement | |
| | case statement | |
| | typecase statement | |
| | expression statement | |
| | loop statement | |
| | yield statement | |
| | quit statement | |
| | protect statement | |
| | raise statement | |
| | assert statement | |
| -- Iters | |
| | while statement | |
| | until statement | |
| | break statement | |
| -- Concurrent programming | |
| | parallel statement | |
| | fork statement | |
| | parallel loop statement | |
| | select statement | |
| | lock statement | |
| | unlock statement | |
| | attach statement | |
| | synchronise statement | |
| | with near statement ; | |
| assign statement = | (expression | (identifier, Colon_SY, [type specifier])), | 
| initialise ; | 
| if statement = | If_SY, expression, guarded clause, | 
| [Elsif_SY, expression, guarded clause}, | |
| [default clause], End_SY ; | 
| guarded clause = Then_SY, statement list ; | 
| default clause = Else_SY, statement list ; | 
| return statement = Return_SY, [expression] ; | 
| case statement = | Case_SY, expression, | 
| value guard, guarded clause, | |
| [{value guard, guarded clause}], | |
| [default clause], End_SY ; | 
| guard = value guard | type guard ; | 
| value guard = When_SY, expression, {Comma_SY, expression} ; | 
| type guard = When_SY, type specifier ; | 
| typecase statement = | Typecase_SY, identifier, | 
| type guard, guarded clause, | |
| [{type guard, guarded clause}], | |
| [default clause], End_SY ; | 
| loop statement = Loop_SY, statement list, End_SY ; | 
| yield statement = Yield_SY, [expression] ; | 
| quit statement = Quit_SY ; | 
| protect statement = | Protect_SY, statement list, | 
| [type guard, guarded clause], | |
| [{type guard, guarded clause}], | |
| [default clause], End_SY | 
| raise statement = Raise_SY, expression ; | 
| assert statement = Assert_SY, expression ; | 
| while statement = While_SY, Iter_SY, parenthesised expression ; | 
| until statement = Until_SY, Iter_SY, parenthesised expression ; | 
| break statement = Break_SY, Iter_SY ; | 
| parallel statement = Parallel_SY, statement list, End_SY ; | 
| fork statement = | Fork_SY, [At_SY, expression, Semicolon_SY], | 
| statement list, End_SY ; | 
| parallel loop statement = | Parloop_SY, statement list, Do_SY, | 
| [At_SY, expression, Semicolon_SY], | |
| statement list, End_SY ; | 
| select statement = | Lock_SY, | 
| select guard, {select guard}, | |
| [default clause], End_SY ; | 
| select guard = lock guard, guarded clause ; | 
| lock guard = [Guard_SY, expression], value guard ; | 
| lock statement = | Lock_SY, expression, | 
| guarded clause, | |
| [default clause], End_SY ; | 
| unlock statement = Unlock_SY, expression ; | 
| attach statement = expression, Do_Attach_SY, expression ; | 
| synchronise statement = Synchronise_SY ; | 
| with near statement = | With_SY, local feature list, | 
| Near_SY, statement list, | |
| [default clause], End_SY ; | 
| local feature list = local feature, {Comma_SY, local feature} ; | 
| local feature = identifier | self expression ; | 
| qualified ident = | (expression, Fullstop_SY) | 
| | (type specifier, Colon_SY, Colon_SY) ; | 
| parenthesised expression = | Left_Parenthesis_SY, | 
| expression, | |
| Right_Parenthesis_SY ; | 
| self expression = Self_SY ; | 
| routine call = qualified ident, identifier, [routine call args] ; | 
| routine call args = | Left_Parenthesis_SY, | 
| routine call arg list, Right_Parenthesis_SY ; | 
| routine call arg list = | routine call argument, | 
| {Comma_Sy, routine call argument} ; | 
| routine call argument = routine mode, expression ; | 
| iter call = qualified ident, iter name, [iter call args] ; | 
| iter call args = | Left_Parenthesis_SY, | 
| iter call arg list, Right_Parenthesis_SY ; | 
| iter call arg list = | iter call argument, | 
| {Comma_Sy, iter call argument} ; | 
| iter call argument = iter mode, expression ; | 
| void test expression = Is_Void_SY, parenthesised expression ; | 
| initial expression = Initial_SY, parenthesised expression ; | 
| result expression = Result_SY ; | 
| routine closure expression = | Bind_SY, Left_Parenthesis_SY, | 
| routine bind expression, Right_Parenthesis_SY ; | 
| routine bind expression = | [qualified ident], identifier, | 
| [routine closure argument expression] ; | 
| routine closure argument expression = | Left_Parenthesis_SY, | 
| routine closure argument list, Right_Parenthsis_SY ; | 
| routine closure argument list = | routine closure argument, | 
| {Comma_SY, routine closure argument} ; | 
| routine closure argument = routine mode, closure argument ; | 
| closure argument = expression | low line ; | 
| iter closure expression = | Bind_SY, Left_Parenthesis_SY, | 
| iter bind expression, Right_Parenthesis_SY ; | 
| iter bind expression = | [qualified ident], iter name, | 
| [iter closure argument expression] ; | 
| iter closure argument expression = | Left_Parenthesis_SY, | 
| iter closure argument list, Right_Parenthesis_SY ; | 
| iter closure argument list = | iter closure argument, | 
| {Comma_SY, iter closure argument} ; | 
| iter closure argument = iter mode, closure argument ; | 
| new expression = New_SY, [parenthesised expression] ; | 
| array expression = Bar_SY, expression list, Bar_SY ; | 
| expression list = expression, {Comma_SY, expression} ; | 
| infix expression = unary expression | binary expression ; | 
| unary expression = unary operator, expression ; | 
| binary expression = | (expression, binary operator, expression) | 
| | (expression, binary logical operator, expression) ; | 
| exception expression = Exception_SY ; | 
| at expression = expression, At_SY, expression ; | 
|  | Specification Index |  | Language Index | 
| Comments
        or enquiries should be made to Keith Hopper. Page last modified: Monday, 12 February 2001. |  |