Wiki
Download
Manual
Eggs
API
Tests
Bugs
show
edit
history
You can edit this page using
wiki syntax
for markup.
Article contents:
== Phosphate Parser Combinators with Error Recovery using {{call/cc}} [[toc:]] === Description Phosphate is a parser-combinator library with error recovering inspired by algebraic effect handlers. Parsers are procedures of three arguments: an SRFI 225 DTO, a dictionary of global state, and a dictionary of dynamic state. Parsers return the new global state and zero or more values. Global state is passed along successful parses and contains the input state of the text to parse. The global state can also be used to store parse-wide settings, such as case folding. The dynamic state is modified and passed around as parsers are composed like Scheme parameters and is used to store the handlers and information such as nesting depth. The dynamic state is not the same as the dynamic extent, although it acts in an analagous way. Unlike the {{parameterize}} form of R7RS, {{parameterize/p}} is guaranteed to tail-call its parser argument. Parse failures and parse errors are handled using a system like algebraic effect handlers (except they use {{call/cc}} instead of delimited continuations). A system parse failure is usually handled by the library, while a user-defined parse error is handled by a user-defined handler. The error handlers get a continuation that allows them to execute code and return values in the raised-from context. === Author Peter McGoron === Repository https://codeberg.org/phm/phosphate/ === Requirements * [[/egg/r7rs|r7rs]] * [[/egg/srfi-225|SRFI 225]] === Examples and API Phosphate has extensive [[https://florida.moe/phosphate/0.1.html|documentation]] with an example showing off how to do error recovery. I wrote it in a separate markup format and it would be very tedious to port it. I will do that later. === Differences with Other Parsers CHICKEN has multiple other libraries for parsing, the main one being [[/egg/comparse|comparse]]. This library exposes a lot of its internals to allow for customization and introspection. For example, the input stream is a dictionary that can be modified on the fly. This library is also designed for error recovery using continuations to jump around the call stack, while comparse does not do this. Parsers written in Phosphate are more verbose and probably slower than ones written with comparse. == Version History ; 0.1.0 : Initial Release === License Copyright (C) Peter McGoron 2026 Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
Description of your changes:
I would like to authenticate
Authentication
Username:
Password:
Spam control
What do you get when you subtract 22 from 11?