The PSEUDO-PRINT library uses the Common Lisp's pretty printing facilities to print pseudo code instead of lisp code. It relies heavily on the use of format strings. See cltl for a great reference on Common Lisp's pretty printer, and for more information on this library including examples see PSEUDO-PRINT.
Note: This library is early days, and many common macros and functions are not yet supported. Patches welcome.
The code is available under the GNU General Public License.
Source:
http://github.com/eschulte/pseudo-print.
Use `with-pseudo-printer' to print lisp code as pseudo code using the normal printing facilities. E.g.,
PSEUDO-PRINT> (with-pseudo-pprinter
(pprint '(if (> a b) (+ a b c) 3/4)))
If (A > B) Then
(A + B + C)
Else
3/4
EndIf
PSEUDO-PRINT> (with-pseudo-pprinter
(pprint '(DEFUN EUCLIDS-GCD (A B)
(IF (= A 0)
B
(DO ()
((= B 0) A)
(IF (> A B)
(SETF A (- A B))
(SETF B (- B A))))))))
Function: EUCLIDS-GCD (A, B)
If (A ≡ 0) Then
B
Else
Do
If (A > B) Then
A <- (A - B)
Else
B <- (B - A)
EndIf
Until (B ≡ 0)
A
EndIf
EndFunction
Customize using the `pseudo-pprinters' variable.
see http://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node253.html
[Special variable]
pseudo-pprinters
List of pseudo-printer functions.
This documentation was prepared with a hacked up version of DOCUMENTATION-TEMPLATE.