Re: Wow, Lisp Reader !!

"Paul Tarvydas (as paultarvydas at gmail dot com)" <[email protected]> Sun, 24 May 2026 08:05:45 -0400
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>
FWIW, my knee-jerk reaction is to think that I would want to use ESRAP (https://scymtym.github.io/esrap/) in conjunction with the read table. I haven't tried it, since I just use PEG parsers and avoid the issue(s) completely.

I see this as a lexer vs. parser issue. You can't (or, at least, shouldn't) use just a lexer (like regex, say) to build every aspect of a parser.

Thing vs. 'Thing vs. Thing' should be lexed into something like (respectively)

[{chars: "Thing"}] 
[{delimiter: singlequote}, {chars: "Thing"}]
[{chars: "Thing"}, {delimiter: singlequote}]. 
Then, a parser should take over with rules like:

sym = <chars> <delimiter>?
quotedsym = <delimiter: singlequote> <sym>
If all you've got is a lexer, or just a readtable, then you have to begin using politically incorrect phrases, like "state change". This is what Forth does. Forth lets you ingest one "word" then change the state of the world in an irreversible manner, i.e. you switch to another lexer. The new lexer must know when to quit and switch back to the original lexer, say by pushing and popping a stack (like a parser does). [opinion: we could do with a lot more non-functional thinking. I took a look at Forth Haiku and observe that what takes 2 lines of Forth gets translated into about 100 lines of GLSL]



pt