Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add proper support for :named smtlib annotations #199

Merged
merged 5 commits into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ next
non linearity and other arithmetic restrictions (PR#184)
- More information for reserved Id, resulting in more precise
errors when smt2 scripts use reserved ids (PR#193)
- Expose implicit declarations/definitions that happen during
typechecking (PR#199)
- Treat smtlib `:named` annotations as implicit definitions as
required by the spec (PR#199)

### Loop

Expand Down
4 changes: 2 additions & 2 deletions doc/tuto.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ let test file =
(* We can loop over the parsed statements to generated the typed statements *)
let final_state, rev_typed_stmts =
List.fold_left (fun (state, acc) parsed_stmt ->
let state, typed_stmt = Typer.check state parsed_stmt in
(state, typed_stmt :: acc)
let state, typed_stmts = Typer.check state parsed_stmt in
(state, List.rev_append typed_stmts acc)
Gbury marked this conversation as resolved.
Show resolved Hide resolved
) (state, []) parsed_statements
in
let typed_stmts = List.rev rev_typed_stmts in
Expand Down
4 changes: 2 additions & 2 deletions doc/type.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ let state =
let () =
let final_state, rev_typed_stmts =
List.fold_left (fun (state, acc) parsed_stmt ->
let state, typed_stmt = Typer.check state parsed_stmt in
(state, typed_stmt :: acc)
let state, typed_stmts = Typer.check state parsed_stmt in
(state, List.rev_append typed_stmts acc)
) (state, []) parsed
in
let typed_stmts = List.rev rev_typed_stmts in
Expand Down
15 changes: 9 additions & 6 deletions src/bin/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ let debug_parsed_pipe st c =
Dolmen.Std.Statement.print c;
st, c

let debug_typed_pipe st stmt =
if Loop.State.get Loop.State.debug st then
Format.eprintf "[logic][typed][%a] @[<hov>%a@]@\n@."
Dolmen.Std.Loc.print_compact stmt.Loop.Typer_Pipe.loc
Loop.Typer_Pipe.print stmt;
st, stmt
let debug_typed_pipe st stmts =
if Loop.State.get Loop.State.debug st then begin
List.iter (fun stmt ->
Format.eprintf "[logic][typed][%a] @[<hov>%a@]@\n"
Dolmen.Std.Loc.print_compact stmt.Loop.Typer_Pipe.loc
Loop.Typer_Pipe.print stmt) stmts;
Format.eprintf "@.";
end;
st, stmts


(* Run dolmen (regular use) *)
Expand Down
1 change: 0 additions & 1 deletion src/loop/parser.ml
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ module Make(State : State.S) = struct
(* Helper functions *)
(* ************************************************************************ *)


let gen_of_llist l =
let l = ref l in
(fun () -> match Lazy.force !l with
Expand Down
2 changes: 1 addition & 1 deletion src/loop/report.ml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ module Error = struct
let internal_error =
mk ~code:Code.bug ~mnemonic:"internal-error"
~message:(fun fmt t ->
Format.fprintf fmt "%t" t)
Format.fprintf fmt "@[<v>%t@ Please report upstream, ^^@]" t)
~name:"Internal Error" ()

let uncaught_exn =
Expand Down
Loading