• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Community
    • 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
        • Bv
        • Imp-language
        • Event-macros
        • Java
          • Atj
            • Atj-implementation
              • Atj-types
              • Atj-java-primitive-array-model
              • Atj-java-abstract-syntax
              • Atj-input-processing
              • Atj-java-pretty-printer
                • Jexpr-rank
                • Print-jexprs
                • Print-jchar
                • Print-jstatems+jblocks
                • Print-jclasses+jcmembers
                • Jbinop-expected-ranks
                • Jexpr->rank
                • Jexpr-rank-<=
                • Print-jexpr
                  • Print-jexpr-list
                • Print-optional-integer-type-suffix
                • Print-octdig/uscore-list
                • Print-oct-integer-literal
                • Print-jcunit
                • Print-hexdig/uscore-list
                • Print-hex-integer-literal
                • Print-decdig/uscore-list
                • Print-dec-integer-literal
                • Print-bindig/uscore-list
                • Print-bin-integer-literal
                • Print-integer-literal
                • Print-octdig/uscore
                • Print-jmethod
                • Print-jfield
                • Print-hexdig/uscore
                • Print-decdig/uscore
                • Print-bindig/uscore
                • Print-jclass-list
                • Print-jlocvar
                • Print-jliteral
                • Print-jcinitializer
                • Print-jline
                • Print-jimports
                • Print-jchars
                • Print-comma-sep
                • Print-jimport
                • Print-jbinop
                • Print-primitive-type
                • Print-jparam-list
                • Print-jlines-to-channel
                • Jexpr-rank-index
                • Atj-indent
                • Print-to-jfile
                • Print-jparam
                • Print-jaccess
                • Print-oct-digit
                • Print-junop
                • Print-jtype
                • Print-jresult
                • Print-hex-digit
                • Print-dec-digit
                • Print-bin-digit
                • Print-jline-blank
              • Atj-code-generation
              • Atj-java-primitives
              • Atj-java-primitive-arrays
              • Atj-type-macros
              • Atj-java-syntax-operations
              • Atj-fn
              • Atj-library-extensions
              • Atj-java-input-types
              • Atj-test-structures
              • Aij-notions
              • Atj-macro-definition
            • Atj-tutorial
          • Aij
          • Language
        • 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
  • Atj-java-pretty-printer

Print-jexpr

Pretty-print an expression.

Signature
(print-jexpr expr expected-rank) → part
Arguments
expr — Guard (jexprp expr).
expected-rank — Guard (jexpr-rankp expected-rank).
Returns
part — Type (msgp part).

See here for motivation.

We first pretty-print the expression, and then we wrap it in parentheses if the expected rank is smaller than the actual rank.

When recursively pretty-printing subexpressions, the ranks argument passed for the subexpressions are determined by the relevant grammar rules.

The function to pretty-print lists of expressions takes a single rank argument, because we only need to pretty-print lists of expressions that all have the same required rank.

Theorem: return-type-of-print-jexpr.part

(defthm return-type-of-print-jexpr.part
  (b* ((?part (print-jexpr expr expected-rank)))
    (msgp part))
  :rule-classes :rewrite)

Theorem: return-type-of-print-jexpr-list.parts

(defthm return-type-of-print-jexpr-list.parts
  (b* ((?parts (print-jexpr-list exprs expected-rank)))
    (msg-listp parts))
  :rule-classes :rewrite)

Subtopics

Print-jexpr-list