Evaluate a form
This relatively advanced system utility translates and evaluates a
form. The following examples illustrate that an error-triple is
returned whose value component is (stobjs-out . values).
ACL2 !>(trans-eval '(+ 3 4) 'my-ctx state nil)
((NIL) . 7)
ACL2 !>(trans-eval '(mv (+ 3 4) (car '(5))) 'my-ctx state nil)
((NIL NIL) 7 5)
(trans-eval form ; an untranslated form
ctx ; a context
aokp) ; allow attachments
The result is an error-triple, (mv erp val state). The value
of erp is non-nil if there is an error when translating form.
Otherwise erp is typically nil, in which case val is a
cons pair whose car is the stobjs-out — a list whose
length is the number of values returned, with nil in each position except
when occupied by a returned stobj for that position — and whose
cdr is the returned value or list of values in the multiple-value
Also see simple-translate-and-eval-cmp in the ACL2 sources, and see
trans-eval-error-triple (and, which is perhaps less useful, trans-eval-state).
If you use trans-eval then you may see a warning, for example as
ACL2 !>(foo st state)
ACL2 Warning [User-stobjs-modified] in FOO: A call of the ACL2 evaluator
on the term (UPDATE-FLD '4 ST) has modified the user stobj ST. See
(4 <state> <st>)
These warnings indicate a potentially serious violation of applicative
semantics when one is also updating user-defined stobjs outside calls of
trans-eval! To understand and perhaps avoid such warnings, see user-stobjs-modified-warnings. Also see trans-eval-and-locally-bound-stobjs for discussion of how trans-eval
modifies global stobj values, not locally-bound stobjs.
- Interactions of trans-eval with stobjs that violate
- How user-defined stobjs are handled by trans-eval
- Trans-eval deals in global stobjs.