https://github.com/niyarin/gorgos
[WIP] Parser combinator for Scheme.
https://github.com/niyarin/gorgos
parser-combinator scheme
Last synced: about 2 months ago
JSON representation
[WIP] Parser combinator for Scheme.
- Host: GitHub
- URL: https://github.com/niyarin/gorgos
- Owner: niyarin
- License: mit
- Created: 2020-11-14T12:15:44.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-25T03:42:19.000Z (over 4 years ago)
- Last Synced: 2025-03-05T10:39:13.413Z (about 1 year ago)
- Topics: parser-combinator, scheme
- Language: Scheme
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Gorgos
[WIP] Parser combinator for Scheme.
This library is in the alpha version and will undergo breaking changes in the future.
## examples
This is an example of an unsinged integer parser.
In Gorgos, you can use (scheme charset).
```scheme
(define unsigned-integer-parser
(gconv (gpair (gcharset char-set:digit)
(glist-of (gcharset char-set:digit)))
(lambda (x) (string->number (list->string x)))))
```
This is an example of creating an integer-parser using the previous unsigned-integer.
```scheme
(define integer-parser
(gconv (gpair (goptional (gchar #\-))
unsigned-integer-parser)
(lambda (x)
(if (null? (car x)) (cdr x) (- (cdr x))))))
```
See the examples directory for details.