-
Notifications
You must be signed in to change notification settings - Fork 2
/
mystery.ah
83 lines (82 loc) · 2.22 KB
/
mystery.ah
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
{
idn: $[a-zA-Z][a-zA-Z0-9.\-]* .
Number: $[-]?[0-9]+ .
} {
VarNameUse: idn .
VarNameDef: idn .
ProcNameDef: idn .
ProcNameUse: idn .
TypeNameDef: idn .
TypeNameUse: idn .
ActualList: ActualList ',' Expr .
ActualList: Expr .
Actuals: .
Actuals: ActualList .
ArrayTy: 'ARRAY' SubrTy 'OF' Type .
Assignment: Expr ':=' Expr .
BlkSem: Block ';' .
Block: Decls 'BEGIN' Stmts 'END' .
Conditional: 'IF' Expr 'THEN' Stmts 'ELSE' Stmts 'END' .
DeclList: .
DeclList: Decl .
DeclList: Decl ';' DeclList .
Decl: ProcDecl .
Decls: DeclList .
Decl: TypeDecl .
Decl: VrblDecl .
Expr: O1 .
Formal: VarNameDef ':' Type .
FormalList: Formal .
FormalList: FormalList ';' Formal .
FormalListT: FormalListT ';' FormalT .
FormalListT: FormalT .
Formals: .
Formals: FormalList .
FormalsT: .
FormalsT: FormalListT .
FormalT: VarNameDef ':' Type .
Iteration: 'WHILE' Expr 'DO' Stmts 'END' .
O1: O2 .
O1: O2 'AND' O2 .
O2: O3 .
O2: O3 '>' O3 .
O3: O3 '+' Operand .
O3: Operand .
Operand: '(' Expr ')' .
Operand: VarNameUse .
Operand: Number .
Operand: ProcNameUse '(' Actuals ')' .
Operand: Operand '[' Expr ']' .
Output: 'PRINT' Expr .
ProcDecl: 'PROCEDURE' ProcNameDef Procedure .
Procedure: '(' Formals ')' '=' Decls 'BEGIN' Stmts 'END' .
Procedure: '(' Formals '):' Type '=' Decls 'BEGIN' Stmts 'END' .
ProcTy: 'PROCEDURE' '(' FormalsT ')' .
ProcTy: 'PROCEDURE' '(' FormalsT ')' ':' Type .
Program: BlkSem .
Program: Block .
Return: 'RETURN' Expr .
Stmt: Assignment .
Stmt: Block .
Stmt: Conditional .
Stmt: Iteration .
StmtList: .
StmtList: Stmt .
StmtList: Stmt ';' StmtList .
Stmt: Operand .
Stmt: Output .
Stmt: Return .
Stmts: StmtList .
SubrTy: '[' Number 'TO' Number ']' .
Type: ArrayTy .
TypeDecl: 'TYPE' TypeNameDef '=' Type .
Type: TypeNameUse .
Type: 'INTEGER' .
Type: ProcTy .
Type: SubrTy .
VrblDecl: 'VAR' VarNameDef ':' Type .
}
{
Type: 'INTEGER' .
Keyword: 'BEGIN' 'PRINT' 'END' 'VAR' 'TYPE' 'RETURN' 'PROCEDURE' 'ARRAY' 'OF' 'WHILE' 'DO' 'END' 'AND' 'TO'.
}