Skip to content

Commit 4721d1c

Browse files
committed
---
yaml --- r: 668 b: refs/heads/master c: c61d021 h: refs/heads/master v: v3
1 parent 0a75bfc commit 4721d1c

File tree

4 files changed

+159
-155
lines changed

4 files changed

+159
-155
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
---
2-
refs/heads/master: b504b3f8d5a3374d079e70c3d6c6d01612e49ecf
2+
refs/heads/master: c61d021f6d97c101ff9d201e5bf8e78eda8c8a1b

trunk/src/boot/fe/ast.ml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,37 @@ and expr =
324324
| EXPR_unary of (unop * atom)
325325
| EXPR_atom of atom
326326

327+
(* FIXME: The redundancy between exprs and pexps is temporary.
328+
* it'll just take a large-ish number of revisions to eliminate. *)
329+
330+
and pexp' =
331+
PEXP_call of (pexp * pexp array)
332+
| PEXP_spawn of (domain * string * pexp)
333+
| PEXP_bind of (pexp * pexp option array)
334+
| PEXP_rec of ((ident * mutability * pexp) array * pexp option)
335+
| PEXP_tup of ((mutability * pexp) array)
336+
| PEXP_vec of mutability * (pexp array)
337+
| PEXP_port
338+
| PEXP_chan of (pexp option)
339+
| PEXP_binop of (binop * pexp * pexp)
340+
| PEXP_lazy_and of (pexp * pexp)
341+
| PEXP_lazy_or of (pexp * pexp)
342+
| PEXP_unop of (unop * pexp)
343+
| PEXP_lval of plval
344+
| PEXP_lit of lit
345+
| PEXP_str of string
346+
| PEXP_box of mutability * pexp
347+
| PEXP_custom of name * (pexp array) * (string option)
348+
349+
and plval =
350+
PLVAL_ident of ident
351+
| PLVAL_app of (ident * (ty array))
352+
| PLVAL_ext_name of (pexp * name_component)
353+
| PLVAL_ext_pexp of (pexp * pexp)
354+
| PLVAL_ext_deref of pexp
355+
356+
and pexp = pexp' Common.identified
357+
327358
and lit =
328359
| LIT_nil
329360
| LIT_bool of bool
@@ -375,7 +406,6 @@ and unop =
375406
| UNOP_neg
376407
| UNOP_cast of ty identified
377408

378-
379409
and header_slots = ((slot identified) * ident) array
380410

381411
and header_tup = (slot identified) array

trunk/src/boot/fe/cexp.ml

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ open Parser;;
2525
*
2626
*)
2727

28-
type meta = (Ast.ident * Pexp.pexp) array;;
28+
type meta = (Ast.ident * Ast.pexp) array;;
2929

30-
type meta_pat = (Ast.ident * (Pexp.pexp option)) array;;
30+
type meta_pat = (Ast.ident * (Ast.pexp option)) array;;
3131

3232
type auth = (Ast.name * Ast.effect);;
3333

@@ -42,22 +42,22 @@ type cexp =
4242
| CEXP_auth of auth identified
4343

4444
and cexp_alt =
45-
{ alt_val: Pexp.pexp;
46-
alt_arms: (Pexp.pexp * cexp array) array;
45+
{ alt_val: Ast.pexp;
46+
alt_arms: (Ast.pexp * cexp array) array;
4747
alt_else: cexp array }
4848

4949
and cexp_let =
5050
{ let_ident: Ast.ident;
51-
let_value: Pexp.pexp;
51+
let_value: Ast.pexp;
5252
let_body: cexp array; }
5353

5454
and cexp_src =
5555
{ src_ident: Ast.ident;
56-
src_path: Pexp.pexp option }
56+
src_path: Ast.pexp option }
5757

5858
and cexp_dir =
5959
{ dir_ident: Ast.ident;
60-
dir_path: Pexp.pexp option;
60+
dir_path: Ast.pexp option;
6161
dir_body: cexp array }
6262

6363
and cexp_use =
@@ -67,7 +67,7 @@ and cexp_use =
6767
and cexp_nat =
6868
{ nat_abi: string;
6969
nat_ident: Ast.ident;
70-
nat_path: Pexp.pexp option;
70+
nat_path: Ast.pexp option;
7171
(*
7272
* FIXME: possibly support embedding optional strings as
7373
* symbol-names, to handle mangling schemes that aren't
@@ -80,7 +80,7 @@ and cexp_nat =
8080

8181
(* Cexp grammar. *)
8282

83-
let parse_meta_input (ps:pstate) : (Ast.ident * Pexp.pexp option) =
83+
let parse_meta_input (ps:pstate) : (Ast.ident * Ast.pexp option) =
8484
let lab = (ctxt "meta input: label" Pexp.parse_ident ps) in
8585
match peek ps with
8686
EQ ->
@@ -120,7 +120,7 @@ let parse_optional_meta_pat
120120
LPAREN -> parse_meta_pat ps
121121
| _ ->
122122
let apos = lexpos ps in
123-
[| ("name", Some (span ps apos apos (Pexp.PEXP_str ident))) |]
123+
[| ("name", Some (span ps apos apos (Ast.PEXP_str ident))) |]
124124
;;
125125

126126
let rec parse_cexps (ps:pstate) (term:Token.token) : cexp array =
@@ -282,7 +282,7 @@ and parse_cexp (ps:pstate) : cexp =
282282
| _ -> raise (unexpected ps)
283283

284284

285-
and parse_eq_pexp_opt (ps:pstate) : Pexp.pexp option =
285+
and parse_eq_pexp_opt (ps:pstate) : Ast.pexp option =
286286
match peek ps with
287287
EQ ->
288288
begin
@@ -493,9 +493,9 @@ and eval_cexp (env:env) (exp:cexp) : cdir array =
493493
| CEXP_auth a -> [| CDIR_auth a.node |]
494494

495495

496-
and eval_pexp (env:env) (exp:Pexp.pexp) : pval =
496+
and eval_pexp (env:env) (exp:Ast.pexp) : pval =
497497
match exp.node with
498-
| Pexp.PEXP_binop (bop, a, b) ->
498+
| Ast.PEXP_binop (bop, a, b) ->
499499
begin
500500
let av = eval_pexp env a in
501501
let bv = eval_pexp env b in
@@ -518,7 +518,7 @@ and eval_pexp (env:env) (exp:Pexp.pexp) : pval =
518518
end
519519
end
520520

521-
| Pexp.PEXP_unop (uop, a) ->
521+
| Ast.PEXP_unop (uop, a) ->
522522
begin
523523
match uop with
524524
Ast.UNOP_not ->
@@ -528,29 +528,29 @@ and eval_pexp (env:env) (exp:Pexp.pexp) : pval =
528528
| _ -> bug () "Unexpected unop in Cexp.eval_pexp"
529529
end
530530

531-
| Pexp.PEXP_lval (Pexp.PLVAL_ident ident) ->
531+
| Ast.PEXP_lval (Ast.PLVAL_ident ident) ->
532532
begin
533533
match ltab_search !(env.env_bindings) ident with
534534
None -> raise (err (Printf.sprintf "no binding for '%s' found"
535535
ident) env.env_ps)
536536
| Some v -> v
537537
end
538538

539-
| Pexp.PEXP_lit (Ast.LIT_bool b) ->
539+
| Ast.PEXP_lit (Ast.LIT_bool b) ->
540540
PVAL_bool b
541541

542-
| Pexp.PEXP_lit (Ast.LIT_int i)
543-
| Pexp.PEXP_lit (Ast.LIT_uint i)
544-
| Pexp.PEXP_lit (Ast.LIT_mach_int (_, i)) ->
542+
| Ast.PEXP_lit (Ast.LIT_int i)
543+
| Ast.PEXP_lit (Ast.LIT_uint i)
544+
| Ast.PEXP_lit (Ast.LIT_mach_int (_, i)) ->
545545
PVAL_num i
546546

547-
| Pexp.PEXP_str s ->
547+
| Ast.PEXP_str s ->
548548
PVAL_str s
549549

550550
| _ -> bug () "unexpected Pexp in Cexp.eval_pexp"
551551

552552

553-
and eval_pexp_to_str (env:env) (exp:Pexp.pexp) : string =
553+
and eval_pexp_to_str (env:env) (exp:Ast.pexp) : string =
554554
match eval_pexp env exp with
555555
PVAL_str s -> s
556556
| v -> unexpected_val "str" v
@@ -560,10 +560,10 @@ and need_num (cv:pval) : int64 =
560560
PVAL_num n -> n
561561
| v -> unexpected_val "num" v
562562

563-
and eval_pexp_to_num (env:env) (exp:Pexp.pexp) : int64 =
563+
and eval_pexp_to_num (env:env) (exp:Ast.pexp) : int64 =
564564
need_num (eval_pexp env exp)
565565

566-
and eval_pexp_to_bool (env:env) (exp:Pexp.pexp) : bool =
566+
and eval_pexp_to_bool (env:env) (exp:Ast.pexp) : bool =
567567
match eval_pexp env exp with
568568
PVAL_bool b -> b
569569
| v -> unexpected_val "bool" v

0 commit comments

Comments
 (0)