Skip to content

Commit

Permalink
rename: more standard naming
Browse files Browse the repository at this point in the history
  • Loading branch information
butterunderflow committed Aug 17, 2024
1 parent 423cd9b commit a3e34a7
Show file tree
Hide file tree
Showing 4 changed files with 222 additions and 222 deletions.
16 changes: 8 additions & 8 deletions lib/syntax/parsetree.ml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ type position = Lexing.position = {
}
[@@deriving sexp]

type 'a node_desc = {
node : 'a;
type 'a node = {
desc : 'a;
start_loc : position;
end_loc : position;
attrs : string list; (* unused now *)
Expand All @@ -42,9 +42,9 @@ and cmp_op =
| Eq
| Neq

and expr = expr_node node_desc
and expr = expr_desc node

and expr_node =
and expr_desc =
| EConst of constant
| EVar of string
| ECons of string
Expand Down Expand Up @@ -72,9 +72,9 @@ and lambda = para * expr

and mod_body = top_level list

and mod_expr = mod_expr_node node_desc
and mod_expr = mod_expr_desc node

and mod_expr_node =
and mod_expr_desc =
| MEName of string (* M *)
| MEStruct of mod_body (* struct ... end *)
| MEFunctor of functor_expr (* functor (M: MT) -> ... *)
Expand Down Expand Up @@ -117,8 +117,8 @@ and emod_ty =

and evariant = string * ety option [@@deriving sexp]

let make_node node start_loc end_loc =
{ node; start_loc; end_loc; attrs = [] }
let make_node desc start_loc end_loc =
{ desc; start_loc; end_loc; attrs = [] }

let dbg prog =
let s = sexp_of_program prog in
Expand Down
4 changes: 2 additions & 2 deletions lib/typing/check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ let check_subtype = Subtype.check_subtype
(* typing expression *)
let rec check_expr (e : T.expr) (env : Env.t) : expr =
try
match e.node with
match e.desc with
| T.EConst c -> check_const c
| T.EVar x -> check_var x env
| T.ELet (x, e0, e1) -> check_let x e0 e1 env
Expand Down Expand Up @@ -395,7 +395,7 @@ and make_mt_by_scope

and check_mod (me : T.mod_expr) (env : Env.t) : mod_expr =
let me_typed =
match me.node with
match me.desc with
| T.MEName name -> check_mod_name name env
| T.MEStruct body -> check_struct body env
| T.MEFunctor ((name, ext_mt0), me1) ->
Expand Down
20 changes: 10 additions & 10 deletions tests/cram/test_dirs/simple.t/run.t
Original file line number Diff line number Diff line change
Expand Up @@ -112,23 +112,23 @@

$ cat simple1.parsing
((TopLet x
((node (EConst (CInt 1)))
((desc (EConst (CInt 1)))
(start_loc
((pos_fname simple.fun) (pos_lnum 1) (pos_bol 0) (pos_cnum 8)))
(end_loc ((pos_fname simple.fun) (pos_lnum 1) (pos_bol 0) (pos_cnum 9)))
(attrs ())))
(TopLet y
((node (EConst (CInt 1)))
((desc (EConst (CInt 1)))
(start_loc
((pos_fname simple.fun) (pos_lnum 3) (pos_bol 11) (pos_cnum 19)))
(end_loc
((pos_fname simple.fun) (pos_lnum 3) (pos_bol 11) (pos_cnum 20)))
(attrs ())))
(TopLet z
((node
((desc
(ELam
((PBare x)
((node (EVar y))
((desc (EVar y))
(start_loc
((pos_fname simple.fun) (pos_lnum 5) (pos_bol 22)
(pos_cnum 40)))
Expand All @@ -142,10 +142,10 @@
((pos_fname simple.fun) (pos_lnum 5) (pos_bol 22) (pos_cnum 41)))
(attrs ())))
(TopLet w
((node
((desc
(ELam
((PBare x)
((node (EConst (CInt 0)))
((desc (EConst (CInt 0)))
(start_loc
((pos_fname simple.fun) (pos_lnum 7) (pos_bol 44)
(pos_cnum 62)))
Expand All @@ -159,20 +159,20 @@
((pos_fname simple.fun) (pos_lnum 7) (pos_bol 44) (pos_cnum 63)))
(attrs ())))
(TopLet m
((node
((desc
(ELam
((PBare x)
((node
((desc
(EApp
((node (EVar w))
((desc (EVar w))
(start_loc
((pos_fname simple.fun) (pos_lnum 9) (pos_bol 66)
(pos_cnum 84)))
(end_loc
((pos_fname simple.fun) (pos_lnum 9) (pos_bol 66)
(pos_cnum 85)))
(attrs ()))
((node (EConst (CInt 1)))
((desc (EConst (CInt 1)))
(start_loc
((pos_fname simple.fun) (pos_lnum 9) (pos_bol 66)
(pos_cnum 86)))
Expand Down
Loading

0 comments on commit a3e34a7

Please sign in to comment.