Mercurial > urweb
comparison src/cjr_print.sml @ 53:4f641f8fddaa
FFI through cjrize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Sun, 22 Jun 2008 10:21:38 -0400 |
parents | 1c91c5e6840f |
children | 717b6f8d8505 |
comparison
equal
deleted
inserted
replaced
52:198172560b73 | 53:4f641f8fddaa |
---|---|
61 string "__lws_", | 61 string "__lws_", |
62 string (Int.toString i)] | 62 string (Int.toString i)] |
63 | TNamed n => | 63 | TNamed n => |
64 (string ("__lwt_" ^ #1 (E.lookupTNamed env n) ^ "_" ^ Int.toString n) | 64 (string ("__lwt_" ^ #1 (E.lookupTNamed env n) ^ "_" ^ Int.toString n) |
65 handle CjrEnv.UnboundNamed _ => string ("__lwt_UNBOUND__" ^ Int.toString n)) | 65 handle CjrEnv.UnboundNamed _ => string ("__lwt_UNBOUND__" ^ Int.toString n)) |
66 | TFfi (m, x) => box [string "lw_", string m, string "_", string x] | |
66 | 67 |
67 and p_typ env = p_typ' false env | 68 and p_typ env = p_typ' false env |
68 | 69 |
69 fun p_rel env n = string ("__lwr_" ^ #1 (E.lookupERel env n) ^ "_" ^ Int.toString (E.countERels env - n - 1)) | 70 fun p_rel env n = string ("__lwr_" ^ #1 (E.lookupERel env n) ^ "_" ^ Int.toString (E.countERels env - n - 1)) |
70 handle CjrEnv.UnboundRel _ => string ("__lwr_UNBOUND_" ^ Int.toString (E.countERels env - n - 1)) | 71 handle CjrEnv.UnboundRel _ => string ("__lwr_UNBOUND_" ^ Int.toString (E.countERels env - n - 1)) |
74 EPrim p => Prim.p_t p | 75 EPrim p => Prim.p_t p |
75 | ERel n => p_rel env n | 76 | ERel n => p_rel env n |
76 | ENamed n => | 77 | ENamed n => |
77 (string ("__lwn_" ^ #1 (E.lookupENamed env n) ^ "_" ^ Int.toString n) | 78 (string ("__lwn_" ^ #1 (E.lookupENamed env n) ^ "_" ^ Int.toString n) |
78 handle CjrEnv.UnboundNamed _ => string ("__lwn_UNBOUND_" ^ Int.toString n)) | 79 handle CjrEnv.UnboundNamed _ => string ("__lwn_UNBOUND_" ^ Int.toString n)) |
80 | EFfi (m, x) => box [string "lw_", string m, string "_", string x] | |
81 | EFfiApp (m, x, es) => box [string "lw_", | |
82 string m, | |
83 string "_", | |
84 string x, | |
85 string "(", | |
86 p_list (p_exp env) es, | |
87 string ")"] | |
79 | ECode n => string ("__lwc_" ^ Int.toString n) | 88 | ECode n => string ("__lwc_" ^ Int.toString n) |
80 | EApp (e1, e2) => parenIf par (box [p_exp' true env e1, | 89 | EApp (e1, e2) => parenIf par (box [p_exp' true env e1, |
81 string "(", | 90 string "(", |
82 p_exp env e2, | 91 p_exp env e2, |
83 string ")"]) | 92 string ")"]) |