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*
|
|
|
|
|
2017-01-06 09:53:40 +00:00
|
|
|
method-definition := #method method-modifier? method-actual-definition
|
2015-05-28 16:51:37 +00:00
|
|
|
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
|
|
|
|
|
2018-05-02 09:53:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
================================================
|
|
|
|
#library Dynlib from 'dyn-lib.so' <--- this is a generic shared library
|
|
|
|
{
|
|
|
|
## no instance variables allowed
|
|
|
|
## class-level(static) functions only.
|
|
|
|
int abc (int, float, void*) <--- call this as Dynlib.abc (...). anc proper type conversion back and forth must occur.
|
|
|
|
int abc (int, float, void*) as abc: aaa x: x y: y <--- remap the original name to a moo-style name.
|
|
|
|
}
|
|
|
|
|
|
|
|
#class abc from 'x11.so' <--- this is a moo-only shared library
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|