• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
      • Kestrel-books
        • Crypto-hdwallet
        • Apt
        • Error-checking
        • Fty-extensions
        • Isar
        • Kestrel-utilities
        • Set
        • Soft
        • C
          • Syntax-for-tools
            • Disambiguator
            • Parser
            • Validator
            • Printer
            • Formalized-subset
            • Mapping-to-language-definition
            • Input-files
            • Defpred
            • Output-files
            • Abstract-syntax-operations
            • Validation-information
            • Implementation-environments
            • Concrete-syntax
            • Ascii-identifiers
            • Unambiguity
            • Preprocessing
            • Abstract-syntax
              • Abstract-syntax-trees
                • Expr
                • Exprs/decls/stmts
                • Type-spec
                • Binop
                • Stmt
                • Amb-expr/tyname
                • Dirdeclor
                • Unop
                • Asm-stmt
                • Dec/oct/hex-const
                • Simple-escape
                  • Simple-escape-fix
                  • Simple-escape-case
                    • Simple-escape-equiv
                    • Simple-escapep
                    • Simple-escape-kind
                    • Simple-escape-v
                    • Simple-escape-t
                    • Simple-escape-squote
                    • Simple-escape-r
                    • Simple-escape-qmark
                    • Simple-escape-percent
                    • Simple-escape-n
                    • Simple-escape-f
                    • Simple-escape-dquote
                    • Simple-escape-bslash
                    • Simple-escape-b
                    • Simple-escape-a
                  • Attrib
                  • Ident
                  • Amb-decl/stmt
                  • Dirabsdeclor
                  • Decl-spec
                  • Structdecl
                  • Fundef
                  • Transunit-ensemble
                  • Asm-name-spec
                  • Amb-declor/absdeclor
                  • Param-declor
                  • Declor
                  • Type-qual
                  • Tyname
                  • Absdeclor
                  • Struni-spec
                  • Stor-spec
                  • Keyword-uscores
                  • Align-spec
                  • Label
                  • Expr-option
                  • Spec/qual
                  • Lsuffix
                  • Hex-frac-const
                  • Desiniter
                  • Iconst
                  • Dirabsdeclor-option
                  • Dec-frac-const
                  • Dec-core-fconst
                  • Extdecl
                  • Amb?-declor/absdeclor
                  • Isuffix
                  • Initdeclor
                  • Hex-core-fconst
                  • Const-expr-option
                  • Attrib-spec
                  • Structdeclor
                  • Escape
                  • Decl
                  • Amb?-expr/tyname
                  • Ident-option
                  • Bin-expo
                  • Absdeclor-option
                  • Statassert
                  • Param-declon
                  • Member-designor
                  • Initer-option
                  • Initer
                  • Fsuffix
                  • Enumspec
                  • Declor-option
                  • Const
                  • Block-item
                  • Hex-quad
                  • Eprefix
                  • Const-expr
                  • Oct-escape
                  • Inc/dec-op
                  • Fun-spec
                  • Dec-expo
                  • Cprefix-option
                  • Asm-name-spec-option
                  • Amb?-decl/stmt
                  • S-char
                  • Isuffix-option
                  • Genassoc
                  • Fundef-option
                  • Fsuffix-option
                  • Fconst
                  • Eprefix-option
                  • Dec-expo-option
                  • Cprefix
                  • C-char
                  • Type-spec-option
                  • Sign-option
                  • Q-char
                  • Iconst-option
                  • H-char
                  • Asm-output
                  • Asm-input
                  • Const-option
                  • Usuffix
                  • Univ-char-name
                  • Transunit
                  • Hprefix
                  • Enumer
                  • Designor
                  • Attrib-name
                  • Sign
                  • Asm-qual
                  • Typequal/attribspec
                  • Dec-expo-prefix
                  • Bin-expo-prefix
                  • Stringlit
                  • Cconst
                  • Expr/tyname
                  • Decl/stmt
                  • Declor/absdeclor
                  • Asm-clobber
                  • Typequal/attribspec-list
                  • Decl-spec-list
                  • Stringlit-list
                  • Spec/qual-list
                  • Inc/dec-op-list
                  • Desiniter-list
                  • S-char-list
                  • Param-declon-list
                  • Decl-list
                  • C-char-list
                  • Block-item-list
                  • Typequal/attribspec-list-list
                  • Structdeclor-list
                  • Structdecl-list
                  • Q-char-list
                  • Initdeclor-list
                  • H-char-list
                  • Genassoc-list
                  • Filepath-transunit-map
                  • Extdecl-list
                  • Enumer-list
                  • Attrib-spec-list
                  • Type-spec-list
                  • Ident-list
                  • Expr-list
                  • Asm-qual-list
                  • Asm-output-list
                  • Asm-input-list
                  • Asm-clobber-list
                  • Stor-spec-list
                  • Ident-set
                  • Ident-option-set
                  • Eprefix-option-list
                  • Designor-list
                  • Attrib-list
                • Abstract-syntax-irrelevants
                • Abstraction-mapping
              • Standard
              • Gcc-builtins
              • Purity
            • Atc
            • Language
            • Transformation-tools
            • Representation
            • Insertion-sort
            • Pack
          • Bv
          • Imp-language
          • Event-macros
          • Java
          • Riscv
          • Bitcoin
          • Ethereum
          • Yul
          • Zcash
          • ACL2-programming-language
          • Prime-fields
          • Json
          • Syntheto
          • File-io-light
          • Cryptography
          • Number-theory
          • Lists-light
          • Axe
          • Builtins
          • Solidity
          • Helpers
          • Htclient
          • Typed-lists-light
          • Arithmetic-light
        • X86isa
        • Axe
        • Execloader
      • Math
      • Testing-utilities
    • Simple-escape

    Simple-escape-case

    Case macro for the different kinds of simple-escape 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 simple-escape structure, or to split into cases based on its type.

    Short Form

    In its short form, simple-escape-case allows you to safely check the type of a simple-escape structure. For example:

    (simple-escape-case x :squote)

    is essentially just a safer alternative to writing:

    (equal (simple-escape-kind x) :squote)

    Why is using simple-escape-case safer? When we directly inspect the kind with equal, there is no static checking being done to ensure that, e.g., :squote is a valid kind of simple-escape structure. That means there is nothing to save you if, later, you change the kind keyword for this type from :squote to something else. It also means you get no help if you just make a typo when writing the :squote symbol. Over the course of developing VL, we found that such issues were very frequent sources of errors!

    Long Form

    In its longer form, simple-escape-case allows you to split into cases based on the kind of structure you are looking at. A typical example would be:

    (simple-escape-case x
      :squote ...
      :dquote ...
      :qmark ...
      :bslash ...
      :a ...
      :b ...
      :f ...
      :n ...
      :r ...
      :t ...
      :v ...
      :percent ...)

    It is also possible to consolidate ``uninteresting'' cases using :otherwise.

    For convenience, the case macro automatically binds the fields of x for you, as appropriate for each case. That is, in the :squote case, you can use fty::defprod-style foo.bar style accessors for x without having to explicitly add a squote b* binder.