Created
October 15, 2019 01:08
-
-
Save ageldama/f478c2d10089c286dd6b2149836b1070 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun tokenize (s &key emit-fn) | |
(let ((lexer-fn (lexer s))) | |
(loop :with token :and val | |
:do (setf (values token val) (funcall lexer-fn)) | |
:while (not (null token)) | |
:if (null emit-fn) | |
:collect (cons token val) | |
:else | |
:do (funcall emit-fn token val)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment