All Projects → s-expressionists → Eclector

s-expressionists / Eclector

Licence: BSD-2-Clause license
A portable Common Lisp reader that is highly customizable, can recover from errors and can return concrete syntax trees

Programming Languages

common lisp
692 projects

Projects that are alternatives of or similar to Eclector

vscode-portable
make visual studio code portable with dll-hijack
Stars: ✭ 17 (-81.91%)
Mutual labels:  portable
PingoMeter
PingoMeter - is a small portable program that show your ping in Windows system tray
Stars: ✭ 91 (-3.19%)
Mutual labels:  portable
qrrs
CLI QR code generator and reader written in rust
Stars: ✭ 29 (-69.15%)
Mutual labels:  reader
codeparser
Parse Wolfram Language source code as abstract syntax trees (ASTs) or concrete syntax trees (CSTs)
Stars: ✭ 84 (-10.64%)
Mutual labels:  concrete-syntax-trees
maildir
A Go package for reading & writing messages in maildir format
Stars: ✭ 13 (-86.17%)
Mutual labels:  reader
MangAdventure
A simple manga hosting CMS written in Django
Stars: ✭ 51 (-45.74%)
Mutual labels:  reader
mp4-rust
🎥 MP4 reader and writer library in Rust! 🦀
Stars: ✭ 149 (+58.51%)
Mutual labels:  reader
Kryptor
A simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign.
Stars: ✭ 267 (+184.04%)
Mutual labels:  portable
twittbot
An advanced Twitter bot.
Stars: ✭ 14 (-85.11%)
Mutual labels:  extensible
msgtools
Tools for Developing Diagnostic Messages
Stars: ✭ 18 (-80.85%)
Mutual labels:  portable
CARE
CHAI and RAJA provide an excellent base on which to build portable codes. CARE expands that functionality, adding new features such as loop fusion capability and a portable interface for many numerical algorithms. It provides all the basics for anyone wanting to write portable code.
Stars: ✭ 22 (-76.6%)
Mutual labels:  portable
core.horse64.org
THIS IS A MIRROR, CHECK https://codeberg.org/Horse64/core.horse64.org
Stars: ✭ 3 (-96.81%)
Mutual labels:  portable
portablebpf
You came here so you could have a base code to serve you as an example on how to develop a BPF application, compatible to BCC and/or LIBBPF, specially LIBBPF, having the userland part made in C or PYTHON.
Stars: ✭ 32 (-65.96%)
Mutual labels:  portable
vapoursynth-portable-FATPACK
A (beginners) bundle with nearly all plugins, many usefull scripts and multiple editors. 64Bit only!
Stars: ✭ 74 (-21.28%)
Mutual labels:  portable
java-class-tools
Read and write java class files in Node.js or in the browser.
Stars: ✭ 27 (-71.28%)
Mutual labels:  reader
voile-rs
Dependently-typed row-polymorphic programming language, evolved from minitt-rs
Stars: ✭ 89 (-5.32%)
Mutual labels:  extensible
SwiftyMercuryReady
Add a "reader" functionality to a WKWebView
Stars: ✭ 74 (-21.28%)
Mutual labels:  reader
nix-portable
Nix - Static, Permissionless, Installation-free, Pre-configured
Stars: ✭ 356 (+278.72%)
Mutual labels:  portable
door-controller-test-tool
Door controller test tool for physical access control devices. (THIS PROJECT IS NO LONGER MAINTAINED)
Stars: ✭ 13 (-86.17%)
Mutual labels:  reader
ck
Portable automation meta-framework to manage, describe, connect and reuse any artifacts, scripts, tools and workflows on any platform with any software and hardware in a non-intrusive way and with minimal effort. Try it using this tutorial to modularize and automate ML Systems benchmarking from the Student Cluster Competition at SC'22:
Stars: ✭ 501 (+432.98%)
Mutual labels:  portable

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.

Usage Overview and Highlights

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))
    ; => (1 2 3)
  • (eclector.reader:read-from-string "#C(1 1)")
    ; => #C(1 1) 7

Error Recovery

In contrast to many other reader implementations, eclector can recover from most errors in the input supplied to it and continue reading. This capability is realized as a restart named eclector.reader:recover which is established whenever an error is signaled for which a recovery strategy is available.

For example, the following code

(handler-bind ((error (lambda (condition)
                        (let ((restart (find-restart 'eclector.reader:recover)))
                          (format t "Recovering from error:~%~2@T~A~%using~%~2@T~A~%"
                                  condition restart))
                        (eclector.reader:recover))))
  (eclector.reader:read-from-string "`(::foo ,"))

produces this:

Recovering from error:
  A symbol token must not start with two package markers as in ::name.
using
  Treat the character as if it had been escaped.
Recovering from error:
  While reading unquote, expected an object when input ended.
using
  Use NIL in place of the missing object.
Recovering from error:
  While reading list, expected the character ) when input ended.
using
  Return a list of the already read elements.
; => (ECLECTOR.READER:QUASIQUOTE (:FOO (ECLECTOR.READER:UNQUOTE NIL))) 9

indicating that eclector recovered from multiple errors and consumed all input. Of course, the returned expression is likely unsuitable for evaluation, but recovery is useful for detecting multiple errors in one go and performing further processing such as static analysis.

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:

(eclector.concrete-syntax-tree:read-from-string "(1 2 3)")
; => #<CONCRETE-SYNTAX-TREE:CONS-CST raw: (1 2 3) {100BF94EF3}> 7 NIL
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].