You are looking at historical revision 4894 of this page. It may differ significantly from its current revision.
This small provides parsing expression grammar pattern matching with the help of the ftl egg. The parsing expressions are implemented as meta interfaces that can be constructed and combined programmatically. Data to match is consumed from arbitrary lookahead input interfaces.
This extension supports static linking.
Mark input (mi)
An arbitrary lookahead input stream. The concrete implementations mi=list, mi=vector, mi=reverse-vector, mi=string, mi=reverse-string are available.
A new implementation of the interface is created as
(mi-interface read empty? mark restore forget)
and the following methods are supported:
((%mi-read mi) in) => (values) | (values obj in)
Reads the next token from the input. If there is no more input, nothing is returned, otherwise the token and the new input are returned.
((%mi-empty? mi) in) => #t | #f
Returns whether the given input has no more tokens to read.
((%mi-mark mi) in) => in
Returns an input to use for further reading if a future reset to the current position may be necessary.
((%mi-restore mi) in) => in
Returns the input reset to the last position stored by the mark method.
((%mi-forget mi) in) => in
Returns the input with the last position stored by the mark method removed.
Represents a parsing expression that can be applied to any mark input.
A new implementation of this interface is created as
and the following basic operation is supported:
(((%m-match-%mi m) mi) in) => (values obj | #f in)
Compares the start of the given mark input to some pattern and returns the matching object and the advanced mark input in case of success or #f and the mark input restored to its former position.
Most likely you will not have to create your own implementations of this interface directly but will rather use one of the generator procedures below.