-
Notifications
You must be signed in to change notification settings - Fork 6
/
language.owl
85 lines (79 loc) · 2.15 KB
/
language.owl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#using owl.v4
.whitespace ' ' '\t'
.line-comment-token '#'
statements = statement{';' | '\n', 1+}
statement =
noop |
expression |
constructor |
method_call |
routine_call |
property_assignment |
variable_assignment |
variable_declaration |
routine_definition |
rule_definition
actions = action{';' | '\n', 1+}
action =
noop |
method_call |
routine_call |
property_assignment |
variable_assignment |
await_condition |
await_routine
noop = ''
constructor = identifier@module_name '=' (identifier@expander_name '.')? identifier@module_type [ '(' expression@argument{','} ')' ]
property_assignment = identifier@module_name '.' identifier@property_name '=' expression
variable_assignment = identifier@variable_name '=' expression
variable_declaration = datatype identifier@variable_name ('=' expression)?
rule_definition = 'when' expression@condition '\n'* [ 'then' actions 'end' ]
routine_definition = 'let' identifier@routine_name [ 'do' actions 'end' ]
routine_call = identifier@routine_name [ '(' ')' ]
await_condition = 'await' expression@condition
await_routine = 'await' identifier@routine_name [ '(' ')' ]
method_call = identifier@module_name '.' identifier@method_name [ '(' expression@argument{','} ')' ]
datatype =
'bool' : boolean
'int' : integer
'float' : number
'str' : string
expression =
'true' : true
'false' : false
string : string
integer : integer
number : number
identifier : variable
identifier@module_name '.' identifier@property_name : property
[ '(' expression ')' ] : parentheses
.operators infix left
'**' : power
.operators prefix
'-' : negate
.operators infix left
'*' : multiply
'/' : divide
'%' : modulo
'//' : floor_divide
.operators infix left
'+' : add
'-' : subtract
.operators infix left
'<<' : shift_left
'>>' : shift_right
'&' : bit_and
'^' : bit_xor
'|' : bit_or
.operators infix left
'>' : greater
'<' : less
'>=' : greater_equal
'<=' : less_equal
'==' : equal
'!=' : unequal
.operators prefix
'!' | 'not' : not
.operators infix left
'&&' | 'and' : and
'||' | 'or' : or