Skip to content

Instantly share code, notes, and snippets.

@kuribas
Last active November 28, 2020 19:55
Show Gist options
  • Save kuribas/271da3669b7791d6e713d70fd9c641ca to your computer and use it in GitHub Desktop.
Save kuribas/271da3669b7791d6e713d70fd9c641ca to your computer and use it in GitHub Desktop.
effects in scheme
(define string-parser
(let* ((escaped-char (effect (run parse-char #\\)
(run any-char)))
(string-char (alternative (none-of '(#\" #\\))
escaped-char))
(parse-quote (parse-char #\")))
(effect
(let* ((_ (run parse-quote))
(chars (run many string-char))
(_ (run parse-quote)))
(apply string chars)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment