2015-05-28 16:51:37 +00:00
|
|
|
|
|
|
|
literal := number-literal | string-literal | character-literal | symbol-literal
|
|
|
|
|
|
|
|
string-literal := single-quote string-character* single-quote
|
|
|
|
string-character := normal-character | (single-quote single-quote)
|
|
|
|
single-quote := "'"
|
|
|
|
normal-character := character-except-single-quote
|
|
|
|
|
|
|
|
character-literal := "$" character
|
|
|
|
character := normal-character | "'"
|
|
|
|
|
|
|
|
symbol-literal := "#" symbol-body
|
|
|
|
symbol-body := identifier | keyword+ | binary-selector | string
|
|
|
|
|
|
|
|
unary-selector := identifier
|
|
|
|
binary-selector := binary-selector-character+
|
|
|
|
binary-selector-character := "+" | "/" | "\" | ...
|
|
|
|
selector-argument := identifier
|
|
|
|
|
|
|
|
identifier := alpha-char (alpha-char | digit-char)*
|
|
|
|
keyword := identifier ":"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class-definition := #class class-modifier? "{" class-body "}"
|
|
|
|
class-modifier := "(" (#byte | #character | #word | #pointer)? ")"
|
|
|
|
class-body := variable-definition* method-definition*
|
|
|
|
|
|
|
|
variable-definition := (#dcl | #declare) variable-modifier? variable-list "."
|
|
|
|
variable-modifier := "(" (#class | #classinst)? ")"
|
|
|
|
variable-list := identifier*
|
|
|
|
|
|
|
|
method-definition := (#mth | #method) method-modifier? method-actual-definition
|
|
|
|
method-modifier := "(" (#class | #instance) ")"
|
|
|
|
method-actual-definition := method-name "{" method-tempraries? method-primitive? method-statements* "}"
|
|
|
|
|
|
|
|
method-name := unary-method-name | binary-method-name | keyword-method-name
|
|
|
|
unary-method-name := unary-selector
|
|
|
|
binary-method-name := binary-selector selector-argument
|
|
|
|
keyword-method-name := (keyword selector-argument)+
|
|
|
|
|
|
|
|
method-temporaries := "|" variable-list "|"
|
|
|
|
method-primitive := "<" "primitive:" integer ">"
|
|
|
|
method-statements := method-statement ("." | ("." method-statements))*
|
2015-06-01 15:59:16 +00:00
|
|
|
method-statement := method-return-statement | method-expression
|
|
|
|
method-return-statement := "^" method-expression
|
2015-05-28 16:51:37 +00:00
|
|
|
|
2015-06-03 04:22:19 +00:00
|
|
|
method-expression := method-assignment-expression | basic-expression
|
2015-06-01 15:59:16 +00:00
|
|
|
method-assignment-expression := identifier ":=" method-expression
|
2015-06-03 17:24:11 +00:00
|
|
|
basic-expression := expression-primary (message-expression cascaded-message-expression)?
|
2015-06-03 04:22:19 +00:00
|
|
|
expression-primary := identifier | literal | block-constructor | ( "(" method-expression ")" )
|
2015-05-28 16:51:37 +00:00
|
|
|
|
|
|
|
----------------------------------------------------------
|
|
|
|
|
2015-06-03 17:24:11 +00:00
|
|
|
message-expression := (unary-message-expression+ binary-message-expresson* keyword-message-expression?) |
|
|
|
|
(binary-message-expression+ keyword-message-expression?) |
|
|
|
|
keyword-message-expression
|
|
|
|
cascaded-message-expression := (";" message-expression)*
|
|
|
|
keyword-message-expression := (keyword keyword-argument)+
|
|
|
|
keyword-argument := expression-primary unary-selector* binary-message-expression*
|
|
|
|
binary-message-expression := binary-selector binary-argument
|
|
|
|
binary-argument := expression-primary unary-selector*
|
|
|
|
|
|
|
|
------------------------------------------------------------
|
|
|
|
|
2015-05-28 16:51:37 +00:00
|
|
|
#include '....'.
|
|
|
|
|
|
|
|
#class Test(Object)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
#main
|
|
|
|
|