The reader-interception Reference Manual

Table of Contents

Next: , Previous: , Up: (dir)   [Contents][Index]

The reader-interception Reference Manual

This is the reader-interception Reference Manual, version 1.0.0, generated automatically by Declt version 2.3 "Robert April" on Tue Feb 20 09:17:22 2018 GMT+0.


Next: , Previous: , Up: Top   [Contents][Index]

1 Introduction

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).



Next: , Previous: , Up: Top   [Contents][Index]

2 Systems

The main system appears first, followed by any subsystem dependency.


Previous: , Up: Systems   [Contents][Index]

2.1 reader-interception

Author

Francois-Rene Rideau

License

MIT

Description

Intercept the reader to replace CL syntax with your own

Version

1.0.0

Source

reader-interception.asd (file)

Component

reader-interception.lisp (file)


Next: , Previous: , Up: Top   [Contents][Index]

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


Previous: , Up: Files   [Contents][Index]

3.1 Lisp


Next: , Previous: , Up: Lisp files   [Contents][Index]

3.1.1 reader-interception.asd

Location

reader-interception.asd

Systems

reader-interception (system)


Previous: , Up: Lisp files   [Contents][Index]

3.1.2 reader-interception/reader-interception.lisp

Parent

reader-interception (system)

Location

reader-interception.lisp

Packages

reader-interception

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

4 Packages

Packages are listed by definition order.


Previous: , Up: Packages   [Contents][Index]

4.1 reader-interception

Source

reader-interception.lisp (file)

Use List

common-lisp

Exported Definitions
Internal Definitions

Next: , Previous: , Up: Top   [Contents][Index]

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


Next: , Previous: , Up: Definitions   [Contents][Index]

5.1 Exported definitions


Next: , Previous: , Up: Exported definitions   [Contents][Index]

5.1.1 Macros

Macro: with-reader-interception (HINT READER) &body BODY

You may override the Common Lisp reader, e.g. around LOAD or COMPILE-FILE, by using WITH-READER-INTERCEPTION (HINT READER) BODY...
thus replacing the CL syntax with any syntax of your choice.
By combining this with ASDF 2.018’s :around-compile hook,
you could compile any language with CL via a proper translation frontend. You *must* specify a HINT to pass to PREPARE-READER-INTERCEPTION,
to help the interception find the first (next) character that will be read, so it can intercept reading from there.
You must specify your READER, a function taking a STREAM as argument, and either returning an object or raising an error
such as READER-ERROR or END-OF-FILE.
Inside the BODY, the *READTABLE* is set so that you may READ
from a stream starting with the hinted character, and
it will use your specified parser instead of the CL reader.
Inside the READER itself, READ will behave like the unintercepted CL reader.

Package

reader-interception

Source

reader-interception.lisp (file)


Previous: , Up: Exported definitions   [Contents][Index]

5.1.2 Functions

Function: prepare-reader-interception HINT &key EXTERNAL-FORMAT

Before you may intercept the CL reader, you MUST prime
the reader-interception with the first character to be read.
You may give the character itself,
NIL for no character (e.g. EOF),
T for any ASCII characters (assuming the first one won’t be further unicode), a stream to read the character from,
a string that will be used as input stream,
a pathname to be open as a stream to read from with specified external-format

Package

reader-interception

Source

reader-interception.lisp (file)


Previous: , Up: Definitions   [Contents][Index]

5.2 Internal definitions


Next: , Previous: , Up: Internal definitions   [Contents][Index]

5.2.1 Special variables

Special Variable: *intercepted-characters*
Package

reader-interception

Source

reader-interception.lisp (file)

Special Variable: *interception-readtable*
Package

reader-interception

Source

reader-interception.lisp (file)

Special Variable: *reader*
Package

reader-interception

Source

reader-interception.lisp (file)

Special Variable: *saved-readtable*
Package

reader-interception

Source

reader-interception.lisp (file)

Special Variable: *standard-readtable*
Package

reader-interception

Source

reader-interception.lisp (file)


Previous: , Up: Internal definitions   [Contents][Index]

5.2.2 Functions

Function: call-with-reader-interception THUNK &optional HINT READER
Package

reader-interception

Source

reader-interception.lisp (file)

Function: initialize-interception ()
Package

reader-interception

Source

reader-interception.lisp (file)

Function: intercept-char-reader STREAM CHAR
Package

reader-interception

Source

reader-interception.lisp (file)

Function: prepare-all-ascii ()
Package

reader-interception

Source

reader-interception.lisp (file)

Function: prepare-character X
Package

reader-interception

Source

reader-interception.lisp (file)

Function: standard-read &key STREAM EOF-ERROR-P EOF-VALUE RECURSIVE-P
Package

reader-interception

Source

reader-interception.lisp (file)


Previous: , Up: Top   [Contents][Index]

Appendix A Indexes


Next: , Previous: , Up: Indexes   [Contents][Index]

A.1 Concepts

Jump to:   F   L   R  
Index Entry  Section

F
File, Lisp, reader-interception.asd: The reader-interception<dot>asd file
File, Lisp, reader-interception/reader-interception.lisp: The reader-interception/reader-interception<dot>lisp file

L
Lisp File, reader-interception.asd: The reader-interception<dot>asd file
Lisp File, reader-interception/reader-interception.lisp: The reader-interception/reader-interception<dot>lisp file

R
reader-interception.asd: The reader-interception<dot>asd file
reader-interception/reader-interception.lisp: The reader-interception/reader-interception<dot>lisp file

Jump to:   F   L   R  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.2 Functions

Jump to:   C   F   I   M   P   S   W  
Index Entry  Section

C
call-with-reader-interception: Internal functions

F
Function, call-with-reader-interception: Internal functions
Function, initialize-interception: Internal functions
Function, intercept-char-reader: Internal functions
Function, prepare-all-ascii: Internal functions
Function, prepare-character: Internal functions
Function, prepare-reader-interception: Exported functions
Function, standard-read: Internal functions

I
initialize-interception: Internal functions
intercept-char-reader: Internal functions

M
Macro, with-reader-interception: Exported macros

P
prepare-all-ascii: Internal functions
prepare-character: Internal functions
prepare-reader-interception: Exported functions

S
standard-read: Internal functions

W
with-reader-interception: Exported macros

Jump to:   C   F   I   M   P   S   W  

Next: , Previous: , Up: Indexes   [Contents][Index]

A.3 Variables

Jump to:   *  
S  
Index Entry  Section

*
*intercepted-characters*: Internal special variables
*interception-readtable*: Internal special variables
*reader*: Internal special variables
*saved-readtable*: Internal special variables
*standard-readtable*: Internal special variables

S
Special Variable, *intercepted-characters*: Internal special variables
Special Variable, *interception-readtable*: Internal special variables
Special Variable, *reader*: Internal special variables
Special Variable, *saved-readtable*: Internal special variables
Special Variable, *standard-readtable*: Internal special variables

Jump to:   *  
S  

Previous: , Up: Indexes   [Contents][Index]

A.4 Data types

Jump to:   P   R   S  
Index Entry  Section

P
Package, reader-interception: The reader-interception package

R
reader-interception: The reader-interception system
reader-interception: The reader-interception package

S
System, reader-interception: The reader-interception system

Jump to:   P   R   S