forked from phyrrus9/lang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAST.txt
More file actions
76 lines (64 loc) · 1.13 KB
/
AST.txt
File metadata and controls
76 lines (64 loc) · 1.13 KB
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
define statement as:
S01 REM text <-----ignored
S02 ;
S03 return;
S04 return expression; <-----evaluates to r = expression; return;
S05 expression;
S06 def <var>;
S07 undef <var>;
S08 <var> = expression;
S09 proc <func> = [ statements ];
S10 procdef <func>;
S11 delete <var>;
S12 print expression;
S13 printc expression;
S14 read <var>;
S15 readc <var>;
S16 call <func>;
S17 push expression;
S18 pop <var>;
S19 parse('filename');
S20 if (expression) -> <func> : <func>;
S21 /* text */
define expression as:
E01 term
E02 term + expression
E03 term - expression
define term as:
T01 factor
T02 factor * expression
T03 factor / expression
T04 (expression)
define factor as:
F01 constant
F02 variable
sample: (see /lang/examples)
S->REM Txt()
S->;
S->return;
S->return E();
S->E();
S->def V();
S->undef V();
S->V() = E();
S->proc V() = [ Ss() ];
S->procdef V();
S->delete V();
S->print E();
S->printc E();
S->read V();
S->readc V();
S->call V();
S->push E();
S->pop V();
S->parse('Fname()');
S->if (E()) -> V() : V();
E->T()
E->T() + E()
E->T() - E()
T->F()
T->F() * E()
T->F() / E()
T->(E())
F->CONSTANT
F->VARIABLE