2009-02-09

lisp code formatter

On Feb 8, 1:45 pm, Jason Nielsen wrote:
> I have a program that is parsing input and emitting sexps (a subset of
> common lisp). I can get this program to dump the output as one long
> string of sexps but that isn't a format that makes it easy to see any
> problems with my parser. Is there an easy way to pretty print lisp code
> in this format (one big ass long string) into something readable? I was
> thinking something along the lines of GNU indent for C.
>
> Thanks,
> Jason

• A Simple Lisp Code Formatter
http://xahlee.org/emacs/lisp_formatter.html

just this month, i tried to “hire” Andy to do it. Here's the result:

http://www.emacswiki.org/emacs/ElispFormat

the code is 1k lines but it's rather in beta stage, and it is tested on elisp only. (current status is “abandoned”.)

I was offering a cheap “thank you” money of $15 (USD) for the work. But due to the problem of small amount and international money transfer, it's not paid. Was offering $50 for a somewhat more robust result, but right now things just hang there. (he wouldn't take paypal ($20 to withdraw for him), no friend i can pay to in US, and he's got more important thing to do this than this small compensation)

If you would write to him, possibly he might pick it up. And if you offer some small amount, combined with mine, there'd be more incentive. (i can pay you, then you add your amount and pay him, so to avoid 3rd party sucking off transaction fee. (a bank wire is $20 a pop)) I'm sure if few more people join in, we can make the code industrial strength that works on any lisp code.

In my opinion, a mechanical lisp formatter is extremely important. (see the section “Automatic, Uniform, Universal, Source Code Display” at http://xahlee.org/UnixResource_dir/writ/lisp_problems.html )

Common Lisp, and perhaps Scheme lisp, has some facility to read lisp code, but the problem is that the compiler throws away comment. Basically unusable for this purpose unless somewhat extensively modified.

If you search back, in 2008 or 2007 there are at least 2 biggist thread on this... someone actually posted a similar request and announcement, that he did a half-assed job of it. In one of the thread, Rainer also gave a common lisp “solution” using its reader (which ditches comments).

(spent 10 min to google group seach but failed. Apparently google search does not exactly search all texts in the post... because i know the exact phrases used the post, yet search results nothing. For those want to find the thread here's tips: i posted to the thread (using xahlee gmail.com or xah xahlee.org), so did Rainer. The date is sometimes in 2008, possibly 2007.
This article:
• A Simple Lisp Code Formatter http://xahlee.org/emacs/lisp_formatter.html
is a edited version from one of my post. Much texts there is verbatim.
A web search will probably return mirrored newsgroup sites of this thread.
)

Xah
∑ http://xahlee.org/



http://groups.google.com/group/comp.lang.lisp/browse_frm/thread/d5016e01d155afaa

No comments:

Post a Comment