parseq
A parser generator for common lisp, inspired by ESRAP

Features:

  • Parses strings, vectors (e.g. binary data) and lists
  • Allows parsing of nested sequences (e.g. trees, strings within lists, ...)
  • Simple interface, very similar to Esrap
  • Provides many specific and non-specific terminal symbols
  • Implements the standard PEG (parsing expression grammar) expressions as well as useful extensions
  • Packrat parsing can be enabled for individual PEG rules
  • Parsing expression rules are compiled
  • Parse tree transformations can be defined together with each PEG rule
  • Grammars can be made context aware:
    • Run parse results of a PEG rule through lisp code to influence parsing success
    • Share data between parse rules
  • Parsing rules can be parameterised
  • Uses separate namespace(s) for parse rules
  • Tracing of grammar rules
  • Meaningful parse error messages

Usage:

First, define a set of grammar rules:
(defrule foo () "foo") (defrule bar () "bar") (defrule foobar () (and foo bar))
The rule foobar will parse the string "foobar".

Parsing is initiated by calling

(parseq 'foobar "foobar")
The result is the list ("foo" "bar").

Homepage:

https://github.com/mrossini-ethz/parseq

Installation:

Parseq can be installed through Quicklisp.

License:

GPL

Quick assessment (2023-03-27)

> (asdf:test-system :parseq/test) Testing PARSEQ-TEST ... Testing PARSEQ-TEST:TREEPOS-TEST ... Failed: (PARSEQ::CONDITION= (PARSEQ::MAKE-TREEPOS -1) ERROR) Total number of tests failed in PARSEQ-TEST:TREEPOS-TEST: 1 Testing PARSEQ-TEST:TERMINAL-TEST ... Testing PARSEQ-TEST:AND-TEST ... Testing PARSEQ-TEST:AND~-TEST ... Testing PARSEQ-TEST:OR-TEST ... Testing PARSEQ-TEST:NOT-TEST ... Testing PARSEQ-TEST:*-TEST ... Testing PARSEQ-TEST:+-TEST ... Testing PARSEQ-TEST:?-TEST ... Testing PARSEQ-TEST:&-TEST ... Testing PARSEQ-TEST:!-TEST ... Testing PARSEQ-TEST:REP-TEST ... Testing PARSEQ-TEST:LIST-TEST ... Testing PARSEQ-TEST:STRING-TEST ... Testing PARSEQ-TEST:STRING-TYPE-TEST ... Testing PARSEQ-TEST:VECTOR-TEST ... Testing PARSEQ-TEST:PARSE-TEST ... Testing PARSEQ-TEST:PARAMETER-TEST ... Testing PARSEQ-TEST:OPTION-TEST ... Testing PARSEQ-TEST:MULTIOPT-TEST ... Testing PARSEQ-TEST:NESTING-TEST ... Testing PARSEQ-TEST:BIND-TEST ... Testing PARSEQ-TEST:NAMESPACE-TEST ... Testing PARSEQ-TEST:PARSE-ERROR-TEST ... Testing PARSEQ-TEST:RECURSION-TEST ... Testing PARSEQ-TEST:LEFT-RECURSION-TEST ... Testing PARSEQ-TEST:PACKRAT-TEST ... Testing PARSEQ-TEST:LOOP-TEST ... Testing PARSEQ-TEST:URL-TEST ... Total number of tests failed in PARSEQ-TEST: 1 T