• Top
    • Documentation
    • Books
    • Boolean-reasoning
    • Projects
    • Debugging
    • Std
    • Proof-automation
    • Macro-libraries
    • ACL2
      • Theories
      • Rule-classes
      • Proof-builder
      • Recursion-and-induction
      • Hons-and-memoization
      • Events
      • Parallelism
      • History
      • Programming
      • Operational-semantics
      • Real
      • Start-here
      • Debugging
      • Miscellaneous
      • Output-controls
      • Macros
      • Interfacing-tools
        • Io
          • Fmt
          • Msg
          • Cw
          • Set-evisc-tuple
          • Set-iprint
          • Print-control
          • Read-file-into-string
          • Std/io
          • Msgp
          • Printing-to-strings
          • Evisc-tuple
          • Output-controls
          • Observation
          • *standard-co*
          • Ppr-special-syms
            • Standard-oi
            • Standard-co
            • Without-evisc
            • Serialize
            • Output-to-file
            • Fmt-to-comment-window
            • Princ$
            • Character-encoding
            • Open-output-channel!
            • Cw-print-base-radix
            • Set-print-case
            • Set-print-base
            • Print-object$
            • Extend-pathname
            • Print-object$+
            • Fmx-cw
            • Set-print-radix
            • Set-fmt-hard-right-margin
            • File-write-date$
            • Proofs-co
            • Set-print-base-radix
            • Print-base-p
            • *standard-oi*
            • Wof
            • File-length$
            • Fms!-lst
            • Delete-file$
            • *standard-ci*
            • Write-list
            • Trace-co
            • Fmt!
            • Fms
            • Cw!
            • Fmt-to-comment-window!
            • Fms!
            • Eviscerate-hide-terms
            • Fmt1!
            • Fmt-to-comment-window!+
            • Read-file-into-byte-array-stobj
            • Fmt1
            • Fmt-to-comment-window+
            • Cw-print-base-radix!
            • Read-file-into-character-array-stobj
            • Fmx
            • Cw!+
            • Read-objects-from-book
            • Newline
            • Cw+
            • Probe-file
            • Write-objects-to-file!
            • Write-objects-to-file
            • Read-objects-from-file
            • Read-object-from-file
            • Read-file-into-byte-list
            • Set-fmt-soft-right-margin
            • Read-file-into-character-list
            • Io-utilities
          • Defttag
          • Sys-call
          • Save-exec
          • Quicklisp
          • Std/io
          • Oslib
          • Bridge
          • Clex
          • Tshell
          • Unsound-eval
          • Hacker
          • ACL2s-interface
          • Startup-banner
          • Command-line
      • Interfacing-tools
        • Io
          • Fmt
          • Msg
          • Cw
          • Set-evisc-tuple
          • Set-iprint
          • Print-control
          • Read-file-into-string
          • Std/io
          • Msgp
          • Printing-to-strings
          • Evisc-tuple
          • Output-controls
          • Observation
          • *standard-co*
          • Ppr-special-syms
            • Standard-oi
            • Standard-co
            • Without-evisc
            • Serialize
            • Output-to-file
            • Fmt-to-comment-window
            • Princ$
            • Character-encoding
            • Open-output-channel!
            • Cw-print-base-radix
            • Set-print-case
            • Set-print-base
            • Print-object$
            • Extend-pathname
            • Print-object$+
            • Fmx-cw
            • Set-print-radix
            • Set-fmt-hard-right-margin
            • File-write-date$
            • Proofs-co
            • Set-print-base-radix
            • Print-base-p
            • *standard-oi*
            • Wof
            • File-length$
            • Fms!-lst
            • Delete-file$
            • *standard-ci*
            • Write-list
            • Trace-co
            • Fmt!
            • Fms
            • Cw!
            • Fmt-to-comment-window!
            • Fms!
            • Eviscerate-hide-terms
            • Fmt1!
            • Fmt-to-comment-window!+
            • Read-file-into-byte-array-stobj
            • Fmt1
            • Fmt-to-comment-window+
            • Cw-print-base-radix!
            • Read-file-into-character-array-stobj
            • Fmx
            • Cw!+
            • Read-objects-from-book
            • Newline
            • Cw+
            • Probe-file
            • Write-objects-to-file!
            • Write-objects-to-file
            • Read-objects-from-file
            • Read-object-from-file
            • Read-file-into-byte-list
            • Set-fmt-soft-right-margin
            • Read-file-into-character-list
            • Io-utilities
          • Defttag
          • Sys-call
          • Save-exec
          • Quicklisp
          • Std/io
          • Oslib
          • Bridge
          • Clex
          • Tshell
          • Unsound-eval
          • Hacker
          • ACL2s-interface
          • Startup-banner
          • Command-line
        • Hardware-verification
        • Software-verification
        • Math
        • Testing-utilities
      • Io

      Ppr-special-syms

      A table to control indentation for pretty-printing

      ACL2 output is generally pretty-printed: that is, spacing and indentation are controlled to enhance readability and aesthetics of the output. Indentation may be controlled by using the table, ppr-special-syms as described below. We thank Stephen Westfold for enhancing the pretty-printer with support for ppr-special-syms.

      The initial value of the ppr-special-syms table is given by the constant *ppr-special-syms* as follows. It associates each key, a symbol, with a corresponding special-term-num as discussed below.

      Definition: *ppr-special-syms*

      (defconst *ppr-special-syms*
        '((case . 1)
          (case-match . 1)
          (defabsstobj . 1)
          (defaxiom . 1)
          (defchoose . 3)
          (defcong . 2)
          (defconst . 1)
          (defmacro . 2)
          (defstobj . 1)
          (defthm . 1)
          (defthmd . 1)
          (defun . 2)
          (defun-inline . 2)
          (defun-sk . 2)
          (defund . 2)
          (encapsulate . 1)
          (if . 2)
          (lambda . 1)
          (lambda$ . 1)
          (let . 1)
          (let* . 1)
          (mutual-recursion . 0)
          (mv-let . 2)
          (table . 1)))

      The ppr-special-syms table is extended for some common macros in the files where they are defined, for example for define and b*.

      For calls of special forms and macros in the ppr-special-syms table, their bodies are indented by 2 rather than in the usual default manner. To support this we allow a special-term-num to be associated with a symbol. Arguments of such symbols in the function position beyond the special-term-num position are indented by 2. Earlier arguments are printed normally. For example, the symbol, let, has a special-term-num of 1, so the first argument is printed normally and subsequent arguments are indented by 2, as follows.

      (LET ((A B)
            (C D))
        (F A C))

      Since `if' has a special-term-num of 2, the first two arguments are printed normally and the other is indented by 2, for example as follows.

      (IF (P A B)
          (F A B)
        (G A B))

      Macros often have as their first argument a symbol, so these are treated specially by putting them on the first line and any remaining arguments before the body arguments begin on the same line if there is space. For example, defun has special-term-num 2, which is evident in the following output.

      (DEFUN FOO (X Y Z)
        (F X Y Z))

      Keyword pairs in macro calls can occur in other places than at the end of an argument list, so keyword pairing is done more aggressively, as in the following output.

      (DEFINE FOO ((X P1)
                   (Y P2))
        :GUARD (P3 X Y)
        (F X Y Z))