Case macro for the different kinds of expression structures.
This is an ACL2::fty sum-type case macro, typically introduced by fty::defflexsum or fty::deftagsum. It allows you to safely check the type of a expression structure, or to split into cases based on its type.
In its short form,
(expression-case x :literal)
is essentially just a safer alternative to writing:
(equal (expression-kind x) :literal)
Why is using expression-case safer? When we directly inspect the
kind with
In its longer form,
(expression-case x :literal ... :variable ... :unary ... :binary ... :if ... :when ... :unless ... :cond ... :call ... :multi ... :component ... :bind ... :product-construct ... :product-field ... :product-update ... :sum-construct ... :sum-field ... :sum-update ... :sum-test ... :bad-expression ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of