Skip to content
A Common Lisp reader that can adapt to different implementations, and that can return Concrete Syntax Trees
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
code Fix typos in comment Mar 16, 2019
documentation
papers/to-submit-1
test tests: Test unknown macro sub character with *READ-SUPPRESS* true Feb 26, 2019
.gitignore
LICENSE
README.md
eclector-concrete-syntax-tree.asd Add :DESCRIPTION to ASDF system definitions Dec 19, 2018
eclector.asd Add :DESCRIPTION to ASDF system definitions Dec 19, 2018
version.sexp Version bump 0.3 -> 0.4 Nov 28, 2018

README.md

Eclector: A portable and extensible Common Lisp Reader

Introduction

The eclector system provides a portable implementation of a reader following the Common Lisp specification.

eclector is under active development. Its ASDF system structure, package structure, exported symbols and protocols may change at any time but are becoming less and less likely to do so in incompatible ways.

This document only gives a very brief overview and highlights some features. Proper documentation can be found in the documentation directory.

Tutorial

Basics

In the simplest case, the eclector reader can be used like any Common Lisp reader:

(with-input-from-string (stream "(1 2 3)")
  (eclector.reader:read stream))

Custom Parse Results

Using features provided in the eclector.parse-result package, the reader can produce parse results controlled by the client, optionally including source tracking and representation of skipped input (due to e.g. comments and reader conditionals):

(defclass my-client (eclector.parse-result:parse-result-client)
  ())

(defmethod eclector.parse-result:make-expression-result
    ((client my-client) (result t) (children t) (source t))
  (list :result result :source source :children children))

(defmethod eclector.parse-result:make-skipped-input-result
    ((client my-client) (stream t) (reason t) (source t))
  (list :reason reason :source source))

(with-input-from-string (stream "(1 #|comment|# \"string\")")
  (eclector.parse-result:read (make-instance 'my-client) stream))

Concrete Syntax Trees

The eclector.concrete-syntax-tree system provides a variant of the eclector reader that produces instances of the concrete syntax tree classes provided by the concrete syntax tree library:

(with-input-from-string (stream "(1 2 3)")
  (eclector.concrete-syntax-tree:cst-read stream))
You can’t perform that action at this time.