How to trace the FGL rewriter
FGL allows attempts at applying rewrite rules to be traced using a configurable tracing function. By default, a basic tracing function is provided such that the user only needs to set up some state global variables to enable and use it. The function that performs the trace printing is attachable, so more advanced users can replace it with a custom version.
The default tracing implementation may be activated by setting the following state globals:
;; Enable the tracing function (assign :fgl-trace-rewrites t) ;; Alist whose keys are the rules that will be traced (assign :fgl-trace-rule-alist '(((:rewrite fgl::fgl-lognot)))) ;; Evisc tuple for trace output (assign :fgl-trace-evisc-tuple (evisc-tuple 8 12 nil nil))
If the attachments for the tracing functions have changed, they may be reset to the default functions as follows:
(fgl-rewrite-trace-defaults)
The default attachment for the tracing functions may be replaced with
custom versions. It may be useful to base it upon the default implementations,
which append "-default" to the name of each function; i.e., the default implementation for
The tracing functions have the following signatures:
(fgl-rewrite-traced-rule-p rule interp-st state) (fgl-rewrite-trace-cond rule fn args interp-st state) (fgl-rewrite-trace-start-output depth rule fn args interp-st state) (fgl-rewrite-trace-success-output depth val rule fn args interp-st state) (fgl-rewrite-trace-failure-output depth failed-hyp rule fn args interp-st state)
where the inputs are as follows: