-
Notifications
You must be signed in to change notification settings - Fork 0
/
syntax.v
48 lines (36 loc) · 1.46 KB
/
syntax.v
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
Require Import partial.
Require Import namesAndTypes.
Import ConcreteEverything.
Inductive Expr :=
| Null : Expr
| Var : VarName_type -> Expr
| FieldSelection : VarName_type -> FieldName_type -> Expr
| FieldAssignment : VarName_type -> FieldName_type -> VarName_type -> Expr
| MethodInvocation : VarName_type -> MethodName_type -> VarName_type -> Expr
| New : class -> Expr
| Box : class -> Expr
| Open : VarName_type -> VarName_type -> Term -> Expr
with
Term :=
| TVar : VarName_type -> Term
| TLet : VarName_type -> Expr -> Term -> Term.
Notation "'t_let' x <- e 't_in' t" := (TLet x e t) (at level 0).
Definition flds := list (FieldName_type * class).
Definition varDefs := list (VarName_type * class).
Record MethDecl : Type := mkMethodDecl {
name: MethodName_type;
argType: typecheck_type;
argName: VarName_type;
retType: typecheck_type;
methodBody: Term;
}.
Record ClassDecl : Type := mkClassDecl {
cls: class;
cdFields: flds;
methods: list MethDecl
}.
Record Program : Type := mkProgram {
classDecls : list ClassDecl;
globals : varDefs;
programBody: Term;
}.