forked from nulang-org/nulang
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSyntax.v
More file actions
39 lines (33 loc) · 1 KB
/
Copy pathSyntax.v
File metadata and controls
39 lines (33 loc) · 1 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
Require Import String.
Require Import List.
Import ListNotations.
(** * Nulang Core Syntax *)
(** Base types *)
Inductive base_ty : Type :=
| TInt : base_ty
| TBool : base_ty
| TString : base_ty
| TUnit : base_ty.
(** Effects *)
Definition effect_name := string.
Definition op_name := string.
Inductive ty : Type :=
| TyBase : base_ty -> ty
| TyFun : ty -> ty -> ty. (* Simplified for now: T1 -> T2 *)
(** Expressions *)
Definition var := string.
Inductive expr : Type :=
| EVar : var -> expr
| EInt : nat -> expr
| EBool : bool -> expr
| EString : string -> expr
| EUnit : expr
| EAdd : expr -> expr -> expr
| ELam : var -> ty -> expr -> expr
| EApp : expr -> expr -> expr
| ELet : var -> expr -> expr -> expr
| EIf : expr -> expr -> expr -> expr
(* Effect operations *)
| EPerform : effect_name -> op_name -> expr -> expr
| EHandle : expr -> effect_name -> op_name -> var -> expr -> expr -> expr.
(* handle e1 with { eff.op(x) => e2, resume is implicitly passed or bound? *)