Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/fare/reader-interception

Portably intercept the Common Lisp reader so you may compile code with arbitrary syntax and semantics
https://github.com/fare/reader-interception

Last synced: 1 day ago
JSON representation

Portably intercept the Common Lisp reader so you may compile code with arbitrary syntax and semantics

Awesome Lists containing this project

README

        

READER-INTERCEPTION

This library allows you to intercept the Lisp reader
and replace the Lisp syntax with your own.

Applications include:
* using COMPILE-FILE to compile files in arbitrary languages,
by having a reader that expands the language into Lisp code.
* having your own improved syntax replace the CL syntax
while using the CL runtime.

==== Exported Functionality ====

The reader-interception library creates a package READER-INTERCEPTION,
that exports the following macros and functions:

WITH-READER-INTERCEPTION ((HINT READER) &BODY BODY)
This macro allows you to intercept the reader within its BODY.
READER is a function that has the same interface as #'CL:READ.
You must pass a HINT, which must be one of:
* the pathname of the file that will be read
* the stream that will be read
* the string that will be read from
* the first character of the file, stream or string that will be read from.
* T if you don't know or care which character that will be, but
can promise it will be ASCII (char-code strictly less than 128).
* NIL if you promise that whichever character will be next read (if any)
has already been seen by the reader-interception
(notably works on empty files/streams/strings).