• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
      • Apt
      • Zfc
      • Acre
      • Milawa
      • Smtlink
      • Abnf
      • Vwsim
      • Isar
      • Wp-gen
      • Dimacs-reader
      • Pfcs
      • Legacy-defrstobj
      • C
      • Proof-checker-array
      • Soft
      • Farray
      • Rp-rewriter
      • Instant-runoff-voting
      • Imp-language
      • Sidekick
      • Ethereum
      • Leftist-trees
      • 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
      • Riscv
      • Taspi
      • Bitcoin
      • Zcash
      • Des
      • X86isa
      • Sha-2
      • Yul
      • Proof-checker-itp13
      • Regex
      • ACL2-programming-language
      • Json
      • Jfkr
      • Equational
      • Cryptography
      • Axe
      • Poseidon
      • Where-do-i-place-my-book
      • Aleo
      • Bigmems
      • Builtins
      • Execloader
      • Solidity
      • Paco
      • Concurrent-programs
      • Bls12-377-curves
    • Debugging
    • Community
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
    • Interfacing-tools
    • Hardware-verification
    • Software-verification
    • 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