-
Notifications
You must be signed in to change notification settings - Fork 0
/
tools.lisp
31 lines (26 loc) · 993 Bytes
/
tools.lisp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
;;;; -*- Mode: Lisp -*-
;;;; tools.lisp --
;;;; A few tools defined on the infrastructure just defined.
;;;; Some inspwction and debugging tools are kept in here.
;;;;
;;;; See file COPYING in main folder for licensing and copyright information.
(in-package "CLAST")
(defun print-element-ast (element
&optional
(out *standard-output*)
(level 0))
"Prints the AST tree rooted at ELEMENT."
(let ((element-string-rep
(typecase element
(form (as-string element))
(t_lambda-list (string-downcase (type-of element)))
(null "NIL")
(list "list-of")
(symbol (format nil "symbol ~A" element))
(t (format nil "unhandled ~A" element))))
)
(format out "~VT ~A~%" (* level 4) element-string-rep)
(dolist (sf (clast-element-subforms element) t)
(print-element-ast sf out (1+ level)))
))
;;;; end of file -- tools.lisp --