Conference paper Open Access

Writing a best-effort portable code walker in Common Lisp

Raskin Mikhail

Dublin Core Export

<?xml version='1.0' encoding='utf-8'?>
<oai_dc:dc xmlns:dc="" xmlns:oai_dc="" xmlns:xsi="" xsi:schemaLocation="">
  <dc:creator>Raskin Mikhail</dc:creator>
  <dc:description>One of the powerful features of the Lisp language family is possibility to extend the language using macros.  Some of possible extensions would benefit from a code walker, i.e. a library for processing code that keeps track of the status of different part of code, for their implementation.  But in practice code walking is generally avoided. 

In this paper, we study facilities useful to code walkers provided by ‘‘Common Lisp: the Language’’ (2nd edition) and the Common Lisp standard.  We will show that the features described in the standard are not sufficient to write a fully portable code walker.

One of the problems is related to a powerful but rarely discussed feature.  The macrolet special form allows a macro function to pass information easily to other macro invocations inside the lexical scope of the expansion.

Another problem for code analysis is related to the usage of non-standard special forms in expansions of standard macros. We review the handling of defun by popular free software Common Lisp implementations.
We also survey the abilities and limitations of the available code walking and recursive macro expansion libraries.  Some examples of apparently-conforming code that exhibit avoidable limitations of the portable code walking tools are provided.

We present a new attempt to implement a portable best-effort code walker for Common Lisp called Agnostic Lizard.
  <dc:subject>code walker</dc:subject>
  <dc:subject>macro expansion</dc:subject>
  <dc:subject>code transformation</dc:subject>
  <dc:title>Writing a best-effort portable code walker in Common Lisp</dc:title>
All versions This version
Views 241241
Downloads 219219
Data volume 65.0 MB65.0 MB
Unique views 227227
Unique downloads 197197


Cite as