10.3. Syntax overview¶
expression |
→ |
constant | unary-message | binary-message | keyword-message | ‘(’ expression ‘)’ |
constant |
→ |
self | number | string | object |
unary-message |
→ |
receiver unary-send | resend ‘.’ unary-send |
unary-send |
→ |
identifier |
binary-message |
→ |
receiver binary-send | resend ‘.’ binary-send |
binary-send |
→ |
operator expression |
keyword-message |
→ |
receiver keyword-send | resend ‘.’ keyword-send |
keyword-send |
→ |
small-keyword expression { cap-keyword expression } |
receiver |
→ |
[ expression ] |
resend |
→ |
resend | identifier |
object |
→ |
regular-object | block |
regular-object |
→ |
‘(’ [ ‘|’ [ ‘{’ ‘}’ ‘=’ string ] slot-list ‘|’ ] [ code ] ‘)’ |
block |
→ |
‘[’ [ ‘|’ slot-list ‘|’ ] [ code ] ‘]’ |
slot-list |
→ |
{ unannotated-slot-list | annotated-slot-list } |
annotated-slot-list |
→ |
‘{’ string slot-list ‘}’ |
unannotated-slot-list |
→ |
{ slot ‘.’} slot [ ‘.’ ] |
code |
→ |
{ expression ‘.’} [ ‘^’ ] expression [ ‘.’ ] |
slot |
→ |
arg-slot | data-slot | binary-slot | keyword-slot |
arg-slot |
→ |
argument-name |
data-slot |
→ |
slot-name | slot-name ‘<-’ expression | slot-name ‘=’ expression |
unary-slot |
→ |
slot-name ‘=’ regular-object |
binary-slot |
→ |
operator ‘=’ regular-object | operator [identifier] ‘=’ regular-object |
keyword-slot |
→ |
small-keyword {cap-keyword} ‘=’ regular-object | small-keyword identifier {cap-keyword identifier} ‘=’ regular-object |
slot-name |
→ |
identifier | parent-name |
parent-name |
→ |
identifier ‘*’ |