# Strongtalk Syntax (Smalltalk + Type Syntax)

Method = MsgPattern Body.

MsgPattern = (UnaryPattern | BinaryPattern | KeywordPattern) [‘^’ Type].

KeywordPattern = keyword VariableDecl {keyword VariableDecl}).

BinaryPattern = binarySel VariableDecl.

UnaryPattern = identifier.

Body = [Temporaries] [Statements].

Temporaries = ‘|’ {VariableDecl} ‘|’.

VariableDecl = Variable [Type].

Statements = Statement {‘.’ Statement} [‘.’].

Statement = [‘^’] Expression.

Expression = {Variable ‘:=’} KeywordExpr {‘;’ Message}.

KeywordExpr = BinaryExpr [KeywordMsg].

BinaryExpr = UnaryExpr {BinaryMsg}.

UnaryExpr = Primary {UnaryMsg}.

Message = UnaryMsg | BinaryMsg | KeywordMsg.

KeywordMsg = keyword BinaryExpr {keyword BinaryExpr}.

BinaryMsg = binarySel UnaryExpr.

UnaryMsg = identifier.

Primary = Variable [TypeArguments] | ‘(’ Expression ‘)’ | Block | Literal | Primitive.

Block = ‘[’ [Parameters] Body ‘]’.

Parameters = {‘:’ VariableDecl} ‘|’.

Literal = number | character | string | ‘#’ (Symbol | Array).

Symbol = identifier | binarySel | keyword {keyword}.

Array = ‘(’ {number | character | string | Symbol | Array} ‘)’.

Primitive = ‘{’ Message ‘}’.

Variable = identifier.

Type = ‘<’ TypeExpr ‘>’.

TypeExpr = TypeTerm {(‘|’ | ‘;’) TypeTerm}.

TypeTerm = TypeFactor {identifier}.

TypeFactor = identifier [TypeArguments].

TypeArguments = ‘[’ Type {‘,’ Type} ‘]’.