Case macro for the different kinds of expr-grade 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 expr-grade structure, or to split into cases based on its type.
In its short form,
(expr-grade-case x :top)
is essentially just a safer alternative to writing:
(equal (expr-grade-kind x) :top)
Why is using expr-grade-case safer? When we directly inspect the
kind with
In its longer form,
(expr-grade-case x :top ... :assignment ... :conditional ... :logical-or ... :logical-and ... :ior ... :xor ... :and ... :equality ... :relational ... :shift ... :additive ... :multiplicative ... :cast ... :unary ... :postfix ... :primary ...)
It is also possible to consolidate ``uninteresting'' cases using
For convenience, the case macro automatically binds the fields of