Commit 10464b01 authored by Hector Suzanne's avatar Hector Suzanne
Browse files

Sauvegarde

parent 52edecbe
......@@ -49,7 +49,7 @@ let parse_cst name inch =
parse lexbuf
let intern_cst cst =
let prelude, prog, env = Intern_prog.internalize cst in
let prelude, prog, _ = Intern_prog.internalize cst in
prelude, prog
let string_of_cst prog =
......
open Intern_prelude
open Vars
let get_pol original_env var =
let env = ref original_env.polarities in
let set_pol pol var =
env := PolVarEnv.add var pol !env in
let set_pol_all pol vars =
List.iter (set_pol pol) vars in
let rec go acc var =
match PolVarEnv.find_opt var !env with
| None -> (None, Redirect var, acc)
| Some (Litteral p) -> (Some p, Litteral p, acc)
| Some (Redirect newvar) -> go (var::acc) newvar in
let (ret, updated, tochange) = go [] var in
set_pol_all updated tochange;
ret, {original_env with polarities = !env}
let new_pol_var ?init env =
let var = PolVar.fresh () in
let env = match init with
| None -> env
| Some p -> {env with polarities = PolVarEnv.add var p env.polarities} in
var, env
open Util
open Vars
open Types
open Constructors
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment