-
Notifications
You must be signed in to change notification settings - Fork 30
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
Use model to simplify report #479
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
(** Manipulate a resource *) | ||
type action = | ||
| Read of IndexTerms.t * IndexTerms.t | ||
| Write of IndexTerms.t * IndexTerms.t | ||
| Create of IndexTerms.t | ||
| Kill of IndexTerms.t | ||
| Call of Sym.t * IndexTerms.t list | ||
| Return of IndexTerms.t | ||
|
||
(** Info about what happened *) | ||
type log_entry = | ||
| Action of action * Locations.t (** We did this. *) | ||
| State of Context.t (** Various things we know about. *) | ||
|
||
(** Steps we took to get here, most recent first *) | ||
type log = log_entry list | ||
|
||
(** Additional information about what went wrong. *) | ||
type state_extras = | ||
{ request : ResourceTypes.t option; (** Requested resource *) | ||
unproven_constraint : LogicalConstraints.t option (** Unproven constraint *) | ||
} | ||
|
||
(** No additional information *) | ||
val no_ex : state_extras | ||
|
||
(** Generate a report describing what went wrong. *) | ||
val trace : Context.t * log -> Solver.model_with_q -> state_extras -> Report.report |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
type state_entry = | ||
{ loc_e : Pp.document option; | ||
loc_v : Pp.document option; | ||
state : Pp.document option | ||
} | ||
|
||
(** Definition of something *) | ||
type term_entry = | ||
{ term : Pp.document; | ||
value : Pp.document | ||
{ term : Pp.document; (** The term being evaluated *) | ||
value : Pp.document (** Its value in the current context *) | ||
} | ||
|
||
(** A clause for a resource *) | ||
type predicate_clause_entry = | ||
{ cond : Pp.document; | ||
clause : Pp.document | ||
{ cond : Pp.document; (** Guard on the resource *) | ||
clause : Pp.document (** The actual resource *) | ||
} | ||
|
||
type resource_entry = | ||
|
@@ -23,21 +19,36 @@ type where_report = | |
{ fnction : string option; | ||
section : string option; | ||
loc_cartesian : ((int * int) * (int * int)) option; | ||
loc_head : string | ||
(** Where in the source file we are *) | ||
loc_head : string (** Name of what we are currently processing *) | ||
} | ||
|
||
(** Information about a specific state of the computation. | ||
The resources, constraints, and terms are pairs because they classify | ||
how relevant the thing might be: | ||
the first component is "interesting", the second is not. *) | ||
type state_report = | ||
{ where : where_report; | ||
resources : Pp.document list * Pp.document list; | ||
constraints : Pp.document list * Pp.document list; | ||
terms : term_entry list * term_entry list | ||
{ where : where_report; (** Location information *) | ||
resources : Pp.document list * Pp.document list; (** Resources *) | ||
constraints : Pp.document list * Pp.document list; (** Constraints *) | ||
terms : term_entry list * term_entry list (** Term values *) | ||
} | ||
Comment on lines
+31
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just for future reference, my preference is that comments should be there to explain why rather than what and variable names should be self explanatory as far as possible. If the variable name would end up being too long, then a short name plus a comment (e.g. as in lines 39-43) is good. |
||
|
||
(** Parts of an HTML rendering of an error. *) | ||
type report = | ||
{ trace : state_report list; | ||
requested : Pp.document option; | ||
unproven : Pp.document option; | ||
{ trace : state_report list; (** The states we went through to get here *) | ||
requested : Pp.document option; (** Resource that we failed to construct *) | ||
unproven : Pp.document option; (** Fact we failed to prove *) | ||
predicate_hints : predicate_clause_entry list | ||
(** Definitions of resource predicates related to the requested one. *) | ||
} | ||
|
||
(** Save a report to a file. | ||
The first argument is the name of the file where the report should be saved. | ||
It is also returned as the result of the function. | ||
|
||
The second argument is the C source code for the report, which is used | ||
to highlight locations. | ||
|
||
The third argument is information about the various things that need to be saved. *) | ||
val make : string -> string Option.m -> report -> string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to extend
go
to know about binders (and not try to evaluate those), so we can apply the evaluation toForall
and to iterated resources.