Subject: Re: reader safe
From: rpw3@rpw3.org (Rob Warnock)
Date: Sun, 24 Dec 2006 22:28:06 -0600
Newsgroups: comp.lang.lisp
Message-ID: <-cGdnVTA8bDLzhLYnZ2dnUVZ_t2tnZ2d@speakeasy.net>
Alex Mizrahi <udodenko@users.sourceforge.net> wrote:
+---------------
| at least i'd like to read it -- i don't want to write my own reader.
+---------------

Actually, writing your own Lisp reader for the subset of forms
to which you're probably going to want to restrict the user input
*anyway* is not a big deal. I hand-compiled a large subset of the
CMUCL reader [mainly so I didn't forget any edge cases] into less
than 500 lines of C [including copious comments!] plus a few tables
that were autogenerated by extracting the initial readtable from
CMUCL. You could do the same thing in CL itself with much less effort.
And if you used a similar readtable/attribute-table approach, the
performance should be quite good. For me, the biggest hunks were
READ-TOKEN, READ-LIST, READ-AFTER-DOT, and then INTERN & FIND-SYMBOL.

Try a quick hack at it. You may find it easier than trying to secure
the built-in READ.


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607