-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax.txt
50 lines (38 loc) · 843 Bytes
/
syntax.txt
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
Placeholders:
x ::= % need to define the set of identifiers %
Definitions:
D ::= x = E
| x(F) = E
Ds ::= epsilon
| D{, D}*
Formal Parameters:
P ::= epsilon
| x{, x}*
Expressions:
E ::= x
| x(A)
| if E then E else E end
| cond [if E then E]{, [if E then E]}* {[else E]}
| local Ds in E end
% modules? probably not in our first draft?
| module export: P from Ds end
| import x [as x] from x
| x.x % for import %
% state
| begin E{; E}* end
| set [x to E]{[x to E]}* end
% control
| handle E with x
| raise E
| error E
% basic data constants & primitive operations, incl. infix notation
% primitive operations:
% numbers, boolean, symbols, chars
% vectors of values, matrices,
| o(A) % primitive operations
Arguments:
A ::= epsilon
| E{, E}*
Programs:
P ::= E
| D{, D}* E