The parseq Reference Manual

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

The parseq Reference Manual

This is the parseq Reference Manual, version 0.5.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Thu Sep 15 05:49:44 2022 GMT+0.

Table of Contents


1 Introduction

PARSEQ

Description

Parseq (pronounced parsec) is a parsing library for common lisp. It can be used for parsing lisp's sequences types: strings, vectors (e.g. binary data) and lists. Furthermore, parseq is able to parse nested structures such as trees (e.g. lists of lists, lists of vectors, vectors of strings).

Parseq uses parsing expression grammars (PEG) that can be defined through a simple interface. Extensions to the standard parsing expressions are available. Parsing expressions can be parameterised and made context aware. Additionally, the definition of each parsing expression allows the arbitrary transformation of the parsing tree.

The library is inspired by Esrap and uses a very similar interface. No code is shared between the two projects, however. The features of Esrap are are mostly included in parseq and complemented with additional, orthogonal features. Any resemblance to esrap-liquid is merely coincidental.

The library is still under development. This means that some features are not yet implemented and that the interface and behaviour may change in the future. See the warnings below.

Features

Parseq provides the following features:

Basic usage

First, define a set of grammar rules:

(defrule foo () "foo")
(defrule bar () "bar")
(defrule foobar () (and foo bar))

The first argument to (defrule ...) is the nonterminal symbol that will represent the rule. These symbols use a different namespace from everything else. The second argument is a list of parameters that the rule takes (none in this example). The third argument specifies the definition of the nonterminal symbol. After the third argument, multiple processing options can be listed.

In this example, the nonterminal foo requires the parsing of the string "foo". The rule foobar combines the two rules foo and bar to match the string "foobar", the list ("foo" "bar") or the vector #("foo" "bar"). The above example could alternatively be stated as

(defrule foobar () (and "foo" "bar"))

thus not requiring the rules foo and bar.

Parsing is initiated by calling

(parseq 'foobar sequence)

which will return the list ("foo" "bar") as well as T if sequence is one of "foobar", ("foo" "bar") and #("foo" "bar"). If parsing is not successful, NIL is returned. The first argument to (parseq ...) is a nonterminal symbol defined through defrule. Note that the symbol must be quoted. The second argument is the sequence that should be parsed. There are optional keyword parameters to (parseq ...):

This concludes the basic usage of the library. Almost everything is done through defrule and parseq. There are some extra arguments, however, that are explained below.

Installation

Parseq is available with quicklisp. You can run

(ql:quickload :parseq)

in the REPL to download, install and load it. To access the symbols from the package without the parseq: prefix you can type

(use-package :parseq)

Alternatively, the system is can be downloaded/cloned from GitHub. The master branch will always point to the latest release. If the system can be found through ASDF, the system can be loaded by typing the following expressions in the REPL:

(require :asdf)                ; unless already loaded
(asdf:load-system :parseq)
(use-package :parseq)          ; optional

Terminals

Terminals (tokens) are the objects that actually appear in the parsed sequence. The following types are item classes:

Literal values can be specified to match specific items or subsequences in the sequence being parsed:

Terminal expressions allow for mor elaborate specifications:

More terminals may be available in later versions of parseq.

Nonterminals

Nonterminal symbols represent parsing expressions that consist of terminals and/or other nonterminals. They can be defined using the defrule macro.

Standard expressions

These are the standard combinations of a parsing expression grammar.

Sequence

(and subexpression ...)

The expression succeeds for a sequence if all subexpressions succeed in the given order. It produces a list of the subexpression results. On success, the amount of input consumed is determined by the subexpressions.

Ordered choice

(or subexpression ...)

The subexpressions are tried in the given order and the result of the first one that succeeds is accepted. It produces the result of the succeeding subexpression. The amount of input consumed depends on the subexpression. If none of the subexpressions match, the expression fails.

Greedy repetition

(* subexpression)

Tries subexpression consecutively as many times as possible. This expression always succeeds because zero repetitions are allowed. A list of the succeeding matches is returned. The amount of input consumed depends on the subexpression and the number of times it matches.

Greedy positive repetition

(+ subexpression)

Like (* subexpression), but at least one repetition is required.

Optional

(? subexpression)

Consumes and returns whatever subexpression consumes if it succeeds. This operation is greedy which means that if the subexpression matches, it will consume the corresponding input. If the subexpression fails, no input is consumed and NIL returned.

Followed-by predicate

(& subexpression)

Succeeds, if subexpression succeeds, but consumes no input. The result of the subexpression is returned.

Not-followed-by predicate

(! subexpression)

Succeeds if subexpression does not succeed. This expression consumes no input. When successful, the next sequence item is returned.

Extended expressions

For convenience, the standard expressions are extended by the following combination methods:

Repetition

(rep 5 subexpression)
(rep (0 5) subexpression)
(rep (2 5) subexpression)
(rep (2 NIL) subexpression)

Succeeds, if subexpression matches exactly 5 times, up to 5 times, between 2 and 5 times, or at least 2 times, respectively. Returns a list of the successful results.

The following abbreviations are allowed for repetitions:

| Abbreviation | Long notation | Meaning | | ------------ |:-------------:| ------------------- | | 3 | (3 3) | Exactly 3 times | | (3) | (0 3) | Up to 3 times | | * | (0 NIL) | Any number of times | | + | (1 NIL) | At least once | | ? | (0 1) | Zero times or once |

Negation

(not subexpression)

Succeeds, if the subexpression does not succeed. When that happens, the rule consumes exactly one item in the sequence and returns it.

Sequence (unordered)

(and~ subexpression ...)

The expression succeeds for a sequence if all subexpressions succeed, in any order. Note that the first subexpression in the list that matches a sequence item will be used. The expression produces a list of the subexpression results (in the order in which they are listed in the rule definition) and consumes whatever the subexpressions consume.

An expression like (and~ 'a 'b 'c 'd) is actually equivalent to

(or (and 'a (or (and 'b (or (and 'c 'd) (and 'd 'c)))
                (and 'c (or (and 'b 'd) (and 'd 'b)))
                (and 'd (or (and 'b 'c) (and 'c 'b)))))
    (and 'b (or (and 'a (or (and 'c 'd) (and 'd 'c)))
                (and 'c (or (and 'a 'd) (and 'd 'a)))
                (and 'd (or (and 'a 'c) (and 'c 'a)))))
    (and 'c (or (and 'a (or (and 'b 'd) (and 'd 'b)))
                (and 'b (or (and 'a 'd) (and 'd 'a)))
                (and 'd (or (and 'a 'b) (and 'b 'a)))))
    (and 'd (or (and 'a (or (and 'b 'c) (and 'c 'b)))
                (and 'b (or (and 'a 'c) (and 'c 'a)))
                (and 'c (or (and 'a 'b) (and 'b 'a))))))

There is a variant of and~ that is more flexible:

(and~~ (1 2 (1) (2 3) (4 nil) ...) subexpr-1 subexpr-2 subexpr-3 subexpr-4 subexpr-5 ...)

The first argument to and~~ specifies how may times each subexpression is allowed to be repeated. (See the rep operator above for a list of abbreviations.) In this example, the first subexpression is required exactly once, the second one exactly twice, the third zero times or once, the fourth between 2 and 3 times and the fifth at least 4 times. During parsing, the prioritisation of the subexpressions that are still applicable is from left to right. The result is a list of lists: The list is ordered in the same way that subexpressions are given in the rule definition. The n-th list within the list contains the results of the n-th subexpression in the order in which they are found in the parsed expression.

Nesting

(list subexpr-1 subexpr-2 ...)
(string subexpr-1 subexpr-2 ...)
(vector subexpr-1 subexpr-2 ...)

Succeeds if the current item in the sequence is a list/string/vector and its content matches the subexpressions in sequence. Returns a list enclosing the subexpression results.

Rule parameters

Often, rules are similar to each other. For example

(defrule html-a () "<a>")
(defrule html-b () "<b>")
(defrule html-span () <span>")

share the same pattern. In parseq, this can be generalised with

(defrule html-tag (name) (and "<" name ">")

and used in parsing expressions as (html-tag "a") instead of having to define each rule separately. The parameters can also be used in the processing options (see below). Note, however, that since the rule parameter is unknown at compile time, a runtime dispatch will need to be performed on the parameter type. In the current implementation, only literal terminals and nonterminals are supported as part of the parsing expression. This will likely change in the future.

It is possible to pass multiple paramters, keywords etc. The full syntax of lambda lists is allowed.

Processing options

There are several options that can be specified for each rule definition. The options can have several effects which are described below.

Transformation of parse results

The result from a parsing rule can be processed. Example:

(defrule abcde () (and (and 'a 'b) 'c (and 'd 'e)))
(parseq 'abcde '(a b c d e))

would normally return ((a b) c (d e)). To process the result, options can be specified in the call to defrule. For example, if you want the resulting list flattened, the rule can be altered to

(defrule abcde () (and (and 'a 'b) 'c (and 'd 'e)) (:flatten))

such that parsing (a b c d e) yields (a b c d e) instead of ((a b) c (d e)).

You can specify how processing of the parsing result is done through multiple options (see below). Additional options (such as :test) do not affect the parse result, but have other effects. Note that the options are processed in sequence and the output of the previous option is input into the next option:

(defrule int+int^2 () (and number number) (:lambda (x y) (+ x y)) (:lambda (x) (expt x 2)))

This would return 25 when parsing the list (2 3).

Constant result

(:constant 1)

This options returns 1 (or whatever you specify) if the rule succeeds, irrespective of the parsing result.

Lambda / Destructure

(:lambda (a b (c d) &rest z) ...)
(:destructure (a b (c d) &rest z) ...)

Destructures the parsing result according to the specified lambda list and binds the given variables. The following forms can be used to process the result in whatever way. The new parsing result is given by what the last form returns. Note that :lambda and :destructure are actually synonyms.

Choose

(:choose 0 2 '(3 1))

Picks items from the parsing result using the given indices and returns them. For the parsing result (15 #\: 24 (#\: 57)) (which might be the parsing result of a time string), the above processing option would return (15 24 57). Non-existent items will result in NIL being returned for them.

Function

(:function #'+)

The parsing result is handed over to the function specified (here: +). Note that the lambda list of the given function has to match the items in the parsing result. The new parsing result is whatever the function returns.

Identity

(:identity t)

Returns the parsing result if the argument is not NIL and NIL otherwise.

Flatten

(:flatten)

Flattens the parsing result, i.e. (a (b c (d) e) (f g)) becomes (a b c d e f g).

String

(:string)

Flattens the parsing result and concatenates the list items to into a string, i.e. (#\a ("bc" (#\d) 'e) (#\f #x67)) becomes "abcdEfg". The items that can be concatenated are strings, characters, unsigned bytes and symbols.

Vector

(:vector)

Flattens the parsing result and converts the resulting list into a vector, i.e. (a (b c (d) e) (f g)) becomes #(a b c d e f g).

Parse result testing

These options do not affect the parse result, but can make the rule fail depending on their input. If a rule fails because of such an option, the processing of subsequent options is skipped.

Test

(:test (x) (and (numberp x) (> x 10)))

Like :lambda or :destructure, except that the return value of the function body is used as a predicate to determine whether the rule succeeds or not. Therefore, if the body of the test returns NIL, the rule fails. Otherwise, the unaltered result is returned. Note that the input to the test (function arguments) depends on the preceding processing options.

In the above example, the rule fails if the parse result is not an number greater than 10.

The following rule matches any symbol except baz:

(defrule not-baz () symbol (:not (x) (eql x 'baz)))

This is not possible with (not 'baz) because that would allow terminals other than symbols, e.g. 5 (which is not a symbol).

Reverse test

(:not (x) (and (numberp x) (> x 10)))

Same as :test, but logically inverted. In this example, the rule fails if the parse result is an number greater than 10.

Variables

Rules can bind variables that can be accessed/modified by subexpressions.

Variable binding

(:let a b (c 10))

Binds the specified variables (dynamically). Subexpressions (and subexpressions of subexpressions, etc) of the rule have access to these variables and can even modify them. In order to access the variables, the subexpressions have to declare them using :external (see below). If a subexpression binds the same variable with another :let, the previous binding is shadowed until the subexpression returns. For an example of variable usage, see the section 'Using context' below.

External bindings

(:external a b c)

Declares the specified variables. If the rule is called by a superior rule that binds these variables (using :let, see above), this rule can use and modify the variables. It is an error if a rule using external variables is called when the variables are unbound (i.e. the rule must be called as a subexpression to a rule defining the variables).

Packrat parsing

Packrat parsing can be enabled for a rule by using the (:packrat t) option. See the wiki page for more information.

Using context

Parsing in parseq can be made context aware using two methods.

Context through tests

A single rule can verify one part of its result against another. For instance, if a tag is a name followed by a type and a value, then the rule

(defrule tag () (and string symbol form) (:test (name type value) (eql (type-of value) type)))

will check whether the value is indeed of the specified type. Otherwise the rule will fail.

Context through variables

It is possible to make rules depend on the results of other rules. This can be achieved through external variable bindings that are introduced with (:let ...) and used with (:external ...).

Suppose the binary format of a file specifies that a string is stored as a byte indicating the length of the string followed by that number of characters. A set of rules for parsing this could be:

(defrule string () (and length chars) (:let len))
(defrule length () byte (:external len) (:lambda (x) (setf len x)))
(defrule chars () (rep len byte) (:external len))

External variables can also be used from within (:test ...) or (:not ...) or even the parse expression.

Rule tracing

Rules can be traced by calling

(trace-rule 'nonterminal-symbol)

which will print the information to standard output. With the keyword argument :recursive t, all rules called from within the given rule will be traced as well. Tracing can be turned off by calling

(untrace-rule 'nonterminal-symbol)

Namespaces

You can use local namespaces for nonterminal symbols:

(with-local-rules
  (defrule ...)
  (defrule ...)
  (parseq ...))

Within the body of with-local-rules new rules can be defined that will be invisible outside. Also, outside rules will be invisible within the body.

Instead of with-local-rules the macro with-saved-rules can be used:

(defrule a ...)
(defrule b ...)
(defrule ab () (and a b))
(with-saved-rules
  (defrule b ...)
  (parseq 'ab ...))
(parseq 'ab ...)

Within its body, rules from outside are still defined and can be redefined without affecting the outside. The rules from outside are saved before entering the body and restored when the body returns.

Upcoming features

These features may be implemented in the future:

Warnings

Please heed the following warnings:

Licence

Parseq is distributed with the GNU General Public License, version 2:

Copyright (C) 2017 Marco Rossini

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

You can also find the full licence online.

Questions/Bugs/Help/Requests/Feedback etc.

If you have questions regarding parseq, found any bugs, would like to offer help, have a feature request, give feedback etc., feel free to contact me through GitHub.


2 Systems

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


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

2.1 parseq

A library for parsing sequences such as strings and lists using parsing expression grammars.

Author

Marco Rossini

License

GPLv2

Version

0.5.0

Source

parseq.asd.

Child Components

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   [Contents][Index]

3.1.1 parseq/parseq.asd

Source

parseq.asd.

Parent Component

parseq (system).

ASDF Systems

parseq.


3.1.2 parseq/package.lisp

Source

parseq.asd.

Parent Component

parseq (system).

Packages

parseq.


3.1.3 parseq/conditions.lisp

Dependency

package.lisp (file).

Source

parseq.asd.

Parent Component

parseq (system).

Public Interface
Internals

3.1.4 parseq/utils.lisp

Dependency

conditions.lisp (file).

Source

parseq.asd.

Parent Component

parseq (system).

Internals

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

3.1.5 parseq/defrule.lisp

Dependency

utils.lisp (file).

Source

parseq.asd.

Parent Component

parseq (system).

Public Interface
Internals

4 Packages

Packages are listed by definition order.


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

4.1 parseq

Source

package.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

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


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

5.1 Public Interface


5.1.1 Macros

Macro: defrule (name lambda-list expr &body options)
Package

parseq.

Source

defrule.lisp.

Macro: with-local-rules (&body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-saved-rules (&body body)
Package

parseq.

Source

defrule.lisp.


5.1.2 Ordinary functions

Function: parseq (rule sequence &key start end junk-allowed parse-error)
Package

parseq.

Source

defrule.lisp.

Function: trace-rule (name &key recursive)
Package

parseq.

Source

defrule.lisp.

Function: untrace-rule (name)
Package

parseq.

Source

defrule.lisp.


5.1.3 Generic functions

Generic Reader: parse-error-position (condition)
Generic Writer: (setf parse-error-position) (condition)
Package

parseq.

Methods
Reader Method: parse-error-position ((condition parse-match-error))
Writer Method: (setf parse-error-position) ((condition parse-match-error))
Source

conditions.lisp.

Target Slot

position.

Generic Reader: parse-error-terminals (condition)
Generic Writer: (setf parse-error-terminals) (condition)
Package

parseq.

Methods
Reader Method: parse-error-terminals ((condition parse-match-error))
Writer Method: (setf parse-error-terminals) ((condition parse-match-error))
Source

conditions.lisp.

Target Slot

terminals.


5.1.4 Conditions

Condition: generic-parse-error

Generic parsing error

Package

parseq.

Source

conditions.lisp.

Direct superclasses

parseq-error.

Direct subclasses
Condition: invalid-operation-error

Error condition for rule definitions where the usage of an operation is invalid.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

rule-definition-error.

Condition: invalid-rule-error

Error condition for malformed calls to rules.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.

Condition: invalid-terminal-error

Error condition for rule definitions where a terminal is unknown.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

rule-definition-error.

Condition: left-recursion-error

Error condition for situations where left recursion is detected at runtime.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.

Condition: parse-junk-error

Error condition for when the sequence is only partially parsed, leaving junk at the end.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

generic-parse-error.

Condition: parse-match-error

Error condition for when the sequence does not match the parsing grammar rules.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

generic-parse-error.

Direct methods
Direct slots
Slot: position
Package

common-lisp.

Initargs

:position

Readers

parse-error-position.

Writers

(setf parse-error-position).

Slot: terminals
Initform

(quote nil)

Initargs

:terminals

Readers

parse-error-terminals.

Writers

(setf parse-error-terminals).

Condition: parseq-error

Generic error for the parseq library

Package

parseq.

Source

conditions.lisp.

Direct superclasses

simple-error.

Direct subclasses
Condition: processing-options-error

Error condition for rule definitions where a processing option is invalid.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

rule-definition-error.

Condition: rule-definition-error

Generic error for rule definitions

Package

parseq.

Source

conditions.lisp.

Direct superclasses

parseq-error.

Direct subclasses
Condition: runtime-error

Generic runtime error

Package

parseq.

Source

conditions.lisp.

Direct superclasses

parseq-error.

Direct subclasses
Condition: unknown-rule-error

Error condition for situations where a rule definition is not found at runtime.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.


5.2 Internals


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

5.2.1 Special variables

Special Variable: *ascii-standard-chars*
Package

parseq.

Source

defrule.lisp.

Special Variable: *packrat-table*
Package

parseq.

Source

defrule.lisp.

Special Variable: *rule-table*
Package

parseq.

Source

defrule.lisp.

Special Variable: *terminal-failure-list*
Package

parseq.

Source

defrule.lisp.

Special Variable: *trace-depth*
Package

parseq.

Source

defrule.lisp.

Special Variable: *trace-recursive*
Package

parseq.

Source

defrule.lisp.

Special Variable: *trace-rule*
Package

parseq.

Source

defrule.lisp.


5.2.2 Macros

Macro: appendf (list &rest items)

Appends the given item to the list using setf.

Package

parseq.

Source

utils.lisp.

Macro: case-test ((keyform &key test) &body clauses)
Package

parseq.

Source

utils.lisp.

Macro: conditional-dynamic-bind ((&rest bindings) condition &body body)

Establishes the dynamic bindings if condition evaluates to true.

Package

parseq.

Source

utils.lisp.

Macro: f-error (type (&rest initargs) control &rest args)

Like (error ...), but allows the condition type to be specified (which is required to inherit from simple-condition).

Package

parseq.

Source

conditions.lisp.

Macro: if-hash ((key hash-table &key var place) then &optional else)
Package

parseq.

Source

utils.lisp.

Macro: let-special ((&rest vars) &body body)
Package

parseq.

Source

utils.lisp.

Macro: or2 (&rest forms)
Package

parseq.

Source

utils.lisp.

Macro: or2-exclusive ((exclusion-list) &rest forms)
Package

parseq.

Source

utils.lisp.

Macro: rule-options-bind ((specials externals processing packrat) options name &body body)
Package

parseq.

Source

defrule.lisp.

Macro: runtime-match (terminal expr pos test result &optional inc)
Package

parseq.

Source

defrule.lisp.

Macro: test-and-advance (terminal expr pos test result &optional inc)
Package

parseq.

Source

defrule.lisp.

Macro: try-and-advance (func pos)
Package

parseq.

Source

defrule.lisp.

Macro: with-expansion (((result-var success-var) expr rule pos args) &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-expansion-failure (((result-var success-var) expr rule pos args) then else)
Package

parseq.

Source

defrule.lisp.

Macro: with-expansion-success (((result-var success-var) expr rule pos args) then else)
Package

parseq.

Source

defrule.lisp.

Macro: with-gensyms ((&rest names) &body body)
Package

parseq.

Source

utils.lisp.

Macro: with-left-recursion-protection ((pos stack) &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-packrat ((enabled name pos lambda-list external-bindings memo) &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-special-vars-from-options (bindings &body body)
Package

parseq.

Source

defrule.lisp.

Macro: with-tracing ((name pos memo) &body body)
Package

parseq.

Source

defrule.lisp.


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

5.2.3 Ordinary functions

Function: cat (&rest items)
Package

parseq.

Source

utils.lisp.

Function: check-range (count range)
Package

parseq.

Source

utils.lisp.

Function: choice-item (treepos tree)

Retrieves an item from the tree by using the given treepointer, or NIL if such a position does not exist.

Package

parseq.

Source

utils.lisp.

Function: copy-hash-table (hash-table)
Package

parseq.

Source

utils.lisp.

Function: decode-range (range)
Package

parseq.

Source

utils.lisp.

Function: expand-! (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-& (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-* (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-+ (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-? (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-and (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-and~ (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-and~~ (expr rep rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-atom (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-choice (indices result)
Package

parseq.

Source

defrule.lisp.

Function: expand-destructure (destruct-lambda result body)
Package

parseq.

Source

defrule.lisp.

Function: expand-list-expr (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-not (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-or (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-parse-call (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-parse-call-recursion (rule args)
Package

parseq.

Source

defrule.lisp.

Function: expand-processing-options (result procs)
Package

parseq.

Source

defrule.lisp.

Function: expand-regexp-bracket-expression (expr)
Package

parseq.

Source

defrule.lisp.

Function: expand-rep (range expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-rule (expr rule pos args)
Package

parseq.

Source

defrule.lisp.

Function: expand-sequence (expr rules pos args type-test terminal)
Package

parseq.

Source

defrule.lisp.

Function: flatten (x)

Flattens the given tree, x, into a list.

Package

parseq.

Source

utils.lisp.

Function: have (item sequence &key test key)
Package

parseq.

Source

utils.lisp.

Function: is-traced (trace-option)
Package

parseq.

Source

defrule.lisp.

Function: is-traced-with-recursion (trace-option)
Package

parseq.

Source

defrule.lisp.

Function: l< (list length)

Tests efficiently whether the length of the list is smaller than the given length.

Package

parseq.

Source

utils.lisp.

Function: l<= (list length)

Tests efficiently whether the length of the list is smaller or equal to the given length.

Package

parseq.

Source

utils.lisp.

Function: l= (list length)

Tests efficiently whether the length of the list is equal to the given length.

Package

parseq.

Source

utils.lisp.

Function: l> (list length)

Tests efficiently whether the length of the list is greater than the given length.

Package

parseq.

Source

utils.lisp.

Function: l>= (list length)

Tests efficiently whether the length of the list is greater or equal to the given length.

Package

parseq.

Source

utils.lisp.

Function: lambda-list-vars (lambda-list)
Package

parseq.

Source

utils.lisp.

Function: last-1 (list)

Retrieves the last item from the given list.

Package

parseq.

Source

utils.lisp.

Function: make-checklist (counts ranges)
Package

parseq.

Source

defrule.lisp.

Function: make-packrat-key (treepos lambda-list external-bindings)

Generates a key for the packrat memoization hash table.

Package

parseq.

Source

defrule.lisp.

Function: make-treepos (&rest indices)

Creates a new tree position object.

Package

parseq.

Source

utils.lisp.

Function: mklist (item)
Package

parseq.

Source

utils.lisp.

Function: parseq-internal (rule sequence pos)
Package

parseq.

Source

defrule.lisp.

Function: push-terminal-failure (pos terminal)
Package

parseq.

Source

defrule.lisp.

Function: quoted-symbol-p (x)
Package

parseq.

Source

utils.lisp.

Function: runtime-dispatch (expr arg pos)
Package

parseq.

Source

defrule.lisp.

Function: sequence= (seq-a seq-b &key start1 start2 end1 end2 test key)
Package

parseq.

Source

utils.lisp.

Function: sequencep (object)
Package

parseq.

Source

utils.lisp.

Function: shuffle (list)

Creates a new list in which the items of the given list are shuffled

Package

parseq.

Source

utils.lisp.

Function: subseq-at (subseq seq pos)
Package

parseq.

Source

utils.lisp.

Function: symbol= (a b)
Package

parseq.

Source

utils.lisp.

Function: treeitem (treepos tree)

Retrieves an item from the tree by using the given treepointer.

Package

parseq.

Source

utils.lisp.

Function: treepos-copy (treepos &optional depth)
Package

parseq.

Source

utils.lisp.

Function: treepos-depth (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-elt (treepos index)
Package

parseq.

Source

utils.lisp.

Function: treepos-highest (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-length (treepos tree)

Determines the length of the item in the tree pointed to by treepos.

Package

parseq.

Source

utils.lisp.

Function: treepos-lowest (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-step (treepos &optional delta)

Copies the tree pointer and increments the tree position.

Package

parseq.

Source

utils.lisp.

Function: treepos-step-down (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-str (treepos)
Package

parseq.

Source

utils.lisp.

Function: treepos-valid (treepos tree)

Verifies whether the given position exists in the given tree.

Package

parseq.

Source

utils.lisp.

Function: treepos= (a b)
Package

parseq.

Source

utils.lisp.

Function: treepos> (a b)
Package

parseq.

Source

utils.lisp.

Function: two-way-index (index list)
Package

parseq.

Source

utils.lisp.

Function: unsigned-byte-p (object)
Package

parseq.

Source

utils.lisp.


5.2.4 Conditions

Condition: invalid-terminal-runtime-error

Error condition for situations where an invalid terminal in an expression is detected at runtime.

Package

parseq.

Source

conditions.lisp.

Direct superclasses

runtime-error.


Appendix A Indexes


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

A.1 Concepts


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

A.2 Functions

Jump to:   (  
A   C   D   E   F   G   H   I   L   M   O   P   Q   R   S   T   U   W  
Index Entry  Section

(
(setf parse-error-position): Public generic functions
(setf parse-error-position): Public generic functions
(setf parse-error-terminals): Public generic functions
(setf parse-error-terminals): Public generic functions

A
appendf: Private macros

C
case-test: Private macros
cat: Private ordinary functions
check-range: Private ordinary functions
choice-item: Private ordinary functions
conditional-dynamic-bind: Private macros
copy-hash-table: Private ordinary functions

D
decode-range: Private ordinary functions
defrule: Public macros

E
expand-!: Private ordinary functions
expand-&: Private ordinary functions
expand-*: Private ordinary functions
expand-+: Private ordinary functions
expand-?: Private ordinary functions
expand-and: Private ordinary functions
expand-and~: Private ordinary functions
expand-and~~: Private ordinary functions
expand-atom: Private ordinary functions
expand-choice: Private ordinary functions
expand-destructure: Private ordinary functions
expand-list-expr: Private ordinary functions
expand-not: Private ordinary functions
expand-or: Private ordinary functions
expand-parse-call: Private ordinary functions
expand-parse-call-recursion: Private ordinary functions
expand-processing-options: Private ordinary functions
expand-regexp-bracket-expression: Private ordinary functions
expand-rep: Private ordinary functions
expand-rule: Private ordinary functions
expand-sequence: Private ordinary functions

F
f-error: Private macros
flatten: Private ordinary functions
Function, cat: Private ordinary functions
Function, check-range: Private ordinary functions
Function, choice-item: Private ordinary functions
Function, copy-hash-table: Private ordinary functions
Function, decode-range: Private ordinary functions
Function, expand-!: Private ordinary functions
Function, expand-&: Private ordinary functions
Function, expand-*: Private ordinary functions
Function, expand-+: Private ordinary functions
Function, expand-?: Private ordinary functions
Function, expand-and: Private ordinary functions
Function, expand-and~: Private ordinary functions
Function, expand-and~~: Private ordinary functions
Function, expand-atom: Private ordinary functions
Function, expand-choice: Private ordinary functions
Function, expand-destructure: Private ordinary functions
Function, expand-list-expr: Private ordinary functions
Function, expand-not: Private ordinary functions
Function, expand-or: Private ordinary functions
Function, expand-parse-call: Private ordinary functions
Function, expand-parse-call-recursion: Private ordinary functions
Function, expand-processing-options: Private ordinary functions
Function, expand-regexp-bracket-expression: Private ordinary functions
Function, expand-rep: Private ordinary functions
Function, expand-rule: Private ordinary functions
Function, expand-sequence: Private ordinary functions
Function, flatten: Private ordinary functions
Function, have: Private ordinary functions
Function, is-traced: Private ordinary functions
Function, is-traced-with-recursion: Private ordinary functions
Function, l<: Private ordinary functions
Function, l<=: Private ordinary functions
Function, l=: Private ordinary functions
Function, l>: Private ordinary functions
Function, l>=: Private ordinary functions
Function, lambda-list-vars: Private ordinary functions
Function, last-1: Private ordinary functions
Function, make-checklist: Private ordinary functions
Function, make-packrat-key: Private ordinary functions
Function, make-treepos: Private ordinary functions
Function, mklist: Private ordinary functions
Function, parseq: Public ordinary functions
Function, parseq-internal: Private ordinary functions
Function, push-terminal-failure: Private ordinary functions
Function, quoted-symbol-p: Private ordinary functions
Function, runtime-dispatch: Private ordinary functions
Function, sequence=: Private ordinary functions
Function, sequencep: Private ordinary functions
Function, shuffle: Private ordinary functions
Function, subseq-at: Private ordinary functions
Function, symbol=: Private ordinary functions
Function, trace-rule: Public ordinary functions
Function, treeitem: Private ordinary functions
Function, treepos-copy: Private ordinary functions
Function, treepos-depth: Private ordinary functions
Function, treepos-elt: Private ordinary functions
Function, treepos-highest: Private ordinary functions
Function, treepos-length: Private ordinary functions
Function, treepos-lowest: Private ordinary functions
Function, treepos-step: Private ordinary functions
Function, treepos-step-down: Private ordinary functions
Function, treepos-str: Private ordinary functions
Function, treepos-valid: Private ordinary functions
Function, treepos=: Private ordinary functions
Function, treepos>: Private ordinary functions
Function, two-way-index: Private ordinary functions
Function, unsigned-byte-p: Private ordinary functions
Function, untrace-rule: Public ordinary functions

G
Generic Function, (setf parse-error-position): Public generic functions
Generic Function, (setf parse-error-terminals): Public generic functions
Generic Function, parse-error-position: Public generic functions
Generic Function, parse-error-terminals: Public generic functions

H
have: Private ordinary functions

I
if-hash: Private macros
is-traced: Private ordinary functions
is-traced-with-recursion: Private ordinary functions

L
l<: Private ordinary functions
l<=: Private ordinary functions
l=: Private ordinary functions
l>: Private ordinary functions
l>=: Private ordinary functions
lambda-list-vars: Private ordinary functions
last-1: Private ordinary functions
let-special: Private macros

M
Macro, appendf: Private macros
Macro, case-test: Private macros
Macro, conditional-dynamic-bind: Private macros
Macro, defrule: Public macros
Macro, f-error: Private macros
Macro, if-hash: Private macros
Macro, let-special: Private macros
Macro, or2: Private macros
Macro, or2-exclusive: Private macros
Macro, rule-options-bind: Private macros
Macro, runtime-match: Private macros
Macro, test-and-advance: Private macros
Macro, try-and-advance: Private macros
Macro, with-expansion: Private macros
Macro, with-expansion-failure: Private macros
Macro, with-expansion-success: Private macros
Macro, with-gensyms: Private macros
Macro, with-left-recursion-protection: Private macros
Macro, with-local-rules: Public macros
Macro, with-packrat: Private macros
Macro, with-saved-rules: Public macros
Macro, with-special-vars-from-options: Private macros
Macro, with-tracing: Private macros
make-checklist: Private ordinary functions
make-packrat-key: Private ordinary functions
make-treepos: Private ordinary functions
Method, (setf parse-error-position): Public generic functions
Method, (setf parse-error-terminals): Public generic functions
Method, parse-error-position: Public generic functions
Method, parse-error-terminals: Public generic functions
mklist: Private ordinary functions

O
or2: Private macros
or2-exclusive: Private macros

P
parse-error-position: Public generic functions
parse-error-position: Public generic functions
parse-error-terminals: Public generic functions
parse-error-terminals: Public generic functions
parseq: Public ordinary functions
parseq-internal: Private ordinary functions
push-terminal-failure: Private ordinary functions

Q
quoted-symbol-p: Private ordinary functions

R
rule-options-bind: Private macros
runtime-dispatch: Private ordinary functions
runtime-match: Private macros

S
sequence=: Private ordinary functions
sequencep: Private ordinary functions
shuffle: Private ordinary functions
subseq-at: Private ordinary functions
symbol=: Private ordinary functions

T
test-and-advance: Private macros
trace-rule: Public ordinary functions
treeitem: Private ordinary functions
treepos-copy: Private ordinary functions
treepos-depth: Private ordinary functions
treepos-elt: Private ordinary functions
treepos-highest: Private ordinary functions
treepos-length: Private ordinary functions
treepos-lowest: Private ordinary functions
treepos-step: Private ordinary functions
treepos-step-down: Private ordinary functions
treepos-str: Private ordinary functions
treepos-valid: Private ordinary functions
treepos=: Private ordinary functions
treepos>: Private ordinary functions
try-and-advance: Private macros
two-way-index: Private ordinary functions

U
unsigned-byte-p: Private ordinary functions
untrace-rule: Public ordinary functions

W
with-expansion: Private macros
with-expansion-failure: Private macros
with-expansion-success: Private macros
with-gensyms: Private macros
with-left-recursion-protection: Private macros
with-local-rules: Public macros
with-packrat: Private macros
with-saved-rules: Public macros
with-special-vars-from-options: Private macros
with-tracing: Private macros

Jump to:   (  
A   C   D   E   F   G   H   I   L   M   O   P   Q   R   S   T   U   W  

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

A.4 Data types

Jump to:   C   D   F   G   I   L   P   R   S   U  
Index Entry  Section

C
Condition, generic-parse-error: Public conditions
Condition, invalid-operation-error: Public conditions
Condition, invalid-rule-error: Public conditions
Condition, invalid-terminal-error: Public conditions
Condition, invalid-terminal-runtime-error: Private conditions
Condition, left-recursion-error: Public conditions
Condition, parse-junk-error: Public conditions
Condition, parse-match-error: Public conditions
Condition, parseq-error: Public conditions
Condition, processing-options-error: Public conditions
Condition, rule-definition-error: Public conditions
Condition, runtime-error: Public conditions
Condition, unknown-rule-error: Public conditions
conditions.lisp: The parseq/conditions․lisp file

D
defrule.lisp: The parseq/defrule․lisp file

F
File, conditions.lisp: The parseq/conditions․lisp file
File, defrule.lisp: The parseq/defrule․lisp file
File, package.lisp: The parseq/package․lisp file
File, parseq.asd: The parseq/parseq․asd file
File, utils.lisp: The parseq/utils․lisp file

G
generic-parse-error: Public conditions

I
invalid-operation-error: Public conditions
invalid-rule-error: Public conditions
invalid-terminal-error: Public conditions
invalid-terminal-runtime-error: Private conditions

L
left-recursion-error: Public conditions

P
Package, parseq: The parseq package
package.lisp: The parseq/package․lisp file
parse-junk-error: Public conditions
parse-match-error: Public conditions
parseq: The parseq system
parseq: The parseq package
parseq-error: Public conditions
parseq.asd: The parseq/parseq․asd file
processing-options-error: Public conditions

R
rule-definition-error: Public conditions
runtime-error: Public conditions

S
System, parseq: The parseq system

U
unknown-rule-error: Public conditions
utils.lisp: The parseq/utils․lisp file

Jump to:   C   D   F   G   I   L   P   R   S   U