Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6285f15
Implemented parsing of custom datatype definitions.
shiva-tk Apr 7, 2025
1c184ba
Added parsing for ADT constructors within LExpr
shiva-tk Apr 8, 2025
8ba6a5e
Completed parsing in WISL for user def datatypes
shiva-tk Apr 8, 2025
0657df0
Refactored WDatatype and WConstructor
shiva-tk Apr 9, 2025
a9c1585
Fixed code style in WDatatype and WConstructor
shiva-tk Apr 9, 2025
5e2ca9f
Added datatypes to GIL program AST
shiva-tk Apr 9, 2025
0a32a1d
Added datatype constructors to GIL expressions
shiva-tk Apr 9, 2025
2d20476
Extended GIL types with datatypes
shiva-tk Apr 9, 2025
9232c71
Refactored GIL Type.DatatypeType
shiva-tk Apr 12, 2025
e5647f9
Compilation of wisl datatypes to gil
shiva-tk Apr 15, 2025
6b06123
Added type inference of constructors
shiva-tk Apr 17, 2025
fdc9554
Style fix
shiva-tk Apr 17, 2025
e526ff1
Initialised Type_env with constructors for verification
shiva-tk Apr 18, 2025
dc32b95
Reductions handles Constructors
shiva-tk Apr 18, 2025
7cf2326
Support for constructors within matching plans
shiva-tk Apr 20, 2025
2496db7
Encoding of types into SMT
shiva-tk Apr 21, 2025
ac7fd4b
Refactored Prog to only store datatype defs
shiva-tk Apr 21, 2025
37d8841
Encoding of ADTs into SMT
shiva-tk Apr 23, 2025
077d6f5
Moved smt into engine.
shiva-tk Apr 24, 2025
742a352
Created datatype env and refactored
shiva-tk Apr 25, 2025
7853a40
Tying up loose ends
shiva-tk Apr 25, 2025
d7d7234
Refactored smt.ml
shiva-tk Apr 26, 2025
23fe5cd
WISL: function -> proc
shiva-tk Apr 26, 2025
f290d9d
Parsing of WISL functions
shiva-tk Apr 27, 2025
0826578
Fixed pretty printer for constructor app in WISL
shiva-tk Apr 27, 2025
9e25b8e
Refactored Constructor -> ConstructorApp
shiva-tk Apr 27, 2025
54e98ae
Added functions and function calls to GIL AST
shiva-tk Apr 27, 2025
9a4995a
Compilation of WISL logical functions.
shiva-tk Apr 28, 2025
5ceaff0
Handling of FuncApp
shiva-tk Apr 29, 2025
0bee009
Encoding of functions into SMT
shiva-tk Apr 30, 2025
2e13fd0
Implemented parsing of case statement in wisl
shiva-tk Apr 30, 2025
0acffa5
Added support for cases statements
shiva-tk May 1, 2025
94f646f
WISL: function -> pure function; proc -> function
shiva-tk May 2, 2025
98e2a1c
Minor refactoring in WISL
shiva-tk May 2, 2025
c67c5c4
Merge remote-tracking branch 'upstream/master' into shiva/user-def-da…
shiva-tk May 2, 2025
a919b0d
Fixed parsing issues
shiva-tk May 2, 2025
ef14bf7
Fixed bugs.
shiva-tk May 4, 2025
a75d37e
Fixed bug in SMT encoding
shiva-tk May 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Gillian-C/lib/gilgen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,8 @@ let trans_program
imports = [];
lemmas = Hashtbl.create 1;
preds = Hashtbl.create 1;
funcs = Hashtbl.create 1;
datatypes = Hashtbl.create 1;
only_specs = Hashtbl.create 1;
macros = Hashtbl.create 1;
bi_specs = make_hashtbl (fun p -> p.BiSpec.bispec_name) bi_specs;
Expand Down
5 changes: 4 additions & 1 deletion Gillian-JS/lib/Compiler/JSIL2GIL.ml
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ let jsil2core_prog (prog : EProg.t) : ('a, string) GProg.t =
~procs:new_procs
~macros:(translate_tbl prog.macros jsil2gil_macro)
~bi_specs:(translate_tbl prog.bi_specs jsil2gil_bispec)
~proc_names:prog.proc_names ~predecessors:(Hashtbl.create 1) ()
~proc_names:prog.proc_names ~predecessors:(Hashtbl.create 1)
~datatypes:(Hashtbl.create 1)
~funcs:(Hashtbl.create 1) (* TODO *)
()
in
result
9 changes: 9 additions & 0 deletions GillianCore/GIL_Syntax/Constructor.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
type t = TypeDef__.constructor = {
constructor_name : string;
constructor_source_path : string option;
constructor_loc : Location.t option;
constructor_num_fields : int;
constructor_fields : Type.t option list;
constructor_datatype : string;
}
[@@deriving yojson]
7 changes: 7 additions & 0 deletions GillianCore/GIL_Syntax/Datatype.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type t = TypeDef__.datatype = {
datatype_name : string;
datatype_source_path : string option;
datatype_loc : Location.t option;
datatype_constructors : Constructor.t list;
}
[@@deriving yojson]
35 changes: 35 additions & 0 deletions GillianCore/GIL_Syntax/Expr.ml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type t = TypeDef__.expr =
(** Existential quantification. *)
| ForAll of (string * Type.t option) list * t
(** Universal quantification. *)
| ConstructorApp of string * t list (** Datatype constructor *)
| FuncApp of string * t list (** Function application *)
| Cases of t * (string * string list * t) list
[@@deriving eq, ord]

let to_yojson = TypeDef__.expr_to_yojson
Expand Down Expand Up @@ -377,6 +380,18 @@ let rec map_opt
match map_e e with
| Some e' -> Some (ForAll (bt, e'))
| _ -> None)
| ConstructorApp (n, les) ->
aux les (fun les -> ConstructorApp (n, les))
| FuncApp (n, les) -> aux les (fun les -> FuncApp (n, les))
| Cases (e, cs) ->
let cs =
List_utils.flaky_map
(fun (c, bs, e) ->
let e = map_e e in
Option.map (fun e -> (c, bs, e)) e)
cs
in
Option.map (fun cs -> Cases (e, cs)) cs
in
Option.map f_after mapped_expr

Expand Down Expand Up @@ -414,6 +429,25 @@ let rec pp fmt e =
Fmt.pf fmt "(forall %a . %a)"
(Fmt.list ~sep:Fmt.comma pp_var_with_type)
bt pp e
| ConstructorApp (n, ll) ->
Fmt.pf fmt "'%s(%a)" n (Fmt.list ~sep:Fmt.comma pp) ll
| FuncApp (n, ll) -> Fmt.pf fmt "%s(%a)" n (Fmt.list ~sep:Fmt.comma pp) ll
| Cases (scrutinee, branches) ->
Fmt.pf fmt "@[<v 2>case %a {@," pp scrutinee;
List.iteri
(fun i (constructor, binders, expr) ->
Fmt.pf fmt " %s" constructor;
(match binders with
| [] -> ()
| _ ->
Fmt.pf fmt "(";
Fmt.pf fmt "%a" (Fmt.list ~sep:(Fmt.any ", ") Fmt.string) binders;
Fmt.pf fmt ")");
Fmt.pf fmt " -> %a" pp expr;
if i < List.length branches - 1 then Fmt.pf fmt ";@,"
else Fmt.pf fmt "@,")
branches;
Fmt.pf fmt "}@]"

let rec full_pp fmt e =
match e with
Expand Down Expand Up @@ -476,6 +510,7 @@ let rec is_concrete (le : t) : bool =
| BinOp (e1, _, e2) -> loop [ e1; e2 ]
| LstSub (e1, e2, e3) -> loop [ e1; e2; e3 ]
| NOp (_, les) | EList les | ESet les -> loop les
| ConstructorApp (_, _) | FuncApp _ | Cases _ -> false

let is_concrete_zero_i : t -> bool = function
| Lit (Int z) -> Z.equal Z.zero z
Expand Down
8 changes: 8 additions & 0 deletions GillianCore/GIL_Syntax/Func.ml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
type t = TypeDef__.func = {
func_name : string;
func_source_path : string option;
func_loc : Location.t option;
func_num_params : int;
func_params : (string * Type.t option) list;
func_definition : Expr.t;
}
3 changes: 3 additions & 0 deletions GillianCore/GIL_Syntax/Gil_syntax.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ module BiSpec = BiSpec
module Branch_case = Branch_case
module Cmd = Cmd
module Constant = Constant
module Constructor = Constructor
module Datatype = Datatype
module Expr = Expr
module Func = Func
module Flag = Flag
module LCmd = LCmd
module Lemma = Lemma
Expand Down
Loading