19.11.2014 Views

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

The Fortress Language Specification - CiteSeerX

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

StaticArg ::= TypeRef<br />

| NatRef<br />

| IntRef<br />

| BoolRef<br />

| DimRef<br />

| UnitRef<br />

| Op<br />

| Id<br />

NatRef ::= Number<br />

| Id<br />

| NatRef NatRef<br />

| NatRef + NatRef<br />

| NatRef · NatRef<br />

| (NatRef )<br />

IntRef ::= NatRef<br />

BoolRef ::= true<br />

| false<br />

| Id<br />

| BoolRef AND BoolRef<br />

| BoolRef OR BoolRef<br />

| (BoolRef )<br />

Expr ::= Flow<br />

| Value<br />

| DottedName[StaticArgList ]<br />

| self<br />

| Expr . Id<br />

| Expr . Id[StaticArgList ]([ExprList])<br />

| Expr Expr<br />

| TraitType.coercion[StaticArgList ](Expr)<br />

| Op Expr<br />

| Expr Op [Expr]<br />

| Expr AssignOp Expr<br />

| Comprehension<br />

| Expr as TypeRef<br />

| Expr asif TypeRef<br />

| UnitExpr<br />

Flow ::= Do<br />

| label Id Expr + end Id<br />

| exit [Id] [with Expr]<br />

| while Expr Do<br />

| for GeneratorList Do<br />

| Accumulator [[ GeneratorList ]] Expr<br />

| if Expr then Expr + (elif Expr then Expr + ) ∗ [Else] end<br />

| (if Expr then Expr + (elif Expr then Expr + ) ∗ Else [end ])<br />

| case Expr [Op] of (Expr ⇒ Expr + ) + [Else] end<br />

| case (largest | smallest ) [Op] of (Expr ⇒ Expr + ) + end<br />

| typecase TypecaseBindings in (TypecaseTypeRefs ⇒ Expr + ) + [Else] end<br />

| atomic Expr<br />

| tryatomic Expr<br />

| spawn Expr<br />

| throw Expr<br />

| try Expr + [catch Id (TraitType ⇒ Expr + ) + ] [forbid TraitTypes] [finally Expr + ] end<br />

380

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!