Table A.1. Complete Syntax of Orc
| E | ::= | Expression | ||
| C | constant value | |||
| | | X | variable | ||
| | |
stop
| silent expression | ||
| | |
( E , ... , E )
| tuple | ||
| | |
[ E , ... , E ]
| list | ||
| | | E G+ | call | ||
| | | op E | prefix operator | ||
| | | E op E | infix operator | ||
| | | E >P> E | sequential combinator | ||
| | | E | E | parallel combinator | ||
| | | E <P< E | pruning combinator | ||
| | | E ; E | otherwise combinator | ||
| | |
lambda ( P , ... , P ) = E | closure (untyped) | ||
| | |
lambda
[ T , ... , T ]
( P , ... , P )
:: T = E | closure (typed) | ||
| | |
if E then E else E | conditional | ||
| | | D E | scoped declaration | ||
| | | E :: T | type ascription | ||
| | | E :!: T | type assertion | ||
| G | ::= | Argument group | ||
( E , ... , E ) | arguments | |||
| | | [ T , ... , T ] ( E , ... , E ) | type parameters plus arguments | ||
| | | .
field | field access | ||
| | | ? | dereference | ||
| C | ::= |
Boolean | Number | String | signal | null
| Constant | |
| X | ::= | identifier | Variable | |
| D | ::= | Declaration | ||
val P = E | value declaration | |||
| | |
site X = address
| site declaration | ||
| | |
class X = classname
| class declaration | ||
| | |
include " filename "
| inclusion | ||
| | |
def X( P , ... , P ) = E | function declaration | ||
| | |
def X[ X , ... , X ]
( T , ... , T ) :: T | function signature | ||
| | |
type X = classname
| type import | ||
| | |
type X[ X , ... , X ] = T | type alias | ||
| | |
type X = UC | ... | UC | datatype declaration (untyped) | ||
| | |
type X[ X , ... , X ] = TC | ... | TC | datatype declaration (typed) | ||
| UC | ::= | X(_, ... ,_) | Constructor (untyped) | |
| TC | ::= | X( T , ... , T ) | Constructor (typed) | |
| P | ::= | Pattern | ||
| X | variable | |||
| | | C | constant | ||
| | |
_
| wildcard | ||
| | | X ( P , ... , P )
| datatype pattern | ||
| | |
( P , ... , P )
| tuple pattern | ||
| | |
[ P , ... , P ]
| list pattern | ||
| | | P : P | cons pattern | ||
| | | P as X | as pattern | ||
| | |
=X | equality pattern | ||
| | | P :: T | type ascription | ||
| T | ::= | Type | ||
| X | Type variable | |||
| | |
Integer | Boolean | String | Number | Signal | Top | Bot
| Ground type | ||
| | |
( T , ... , T )
| Tuple type | ||
| | |
lambda [ X , ... , X ] ( T , ... , T ) :: T | Function type | ||
| | | X[ T , ... , T ]
| Type application |
Where relevant, syntactic constructs are ordered by precedence, from highest to lowest. For example, among expressions, calls have higher precedence than any of the combinators, which in turn have higher precedence than conditionals.