From 401fd8f16664d81d84c2fd7ecbc2333d6f3ec108 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Manuel=20Tom=C3=A1s?= Date: Fri, 28 Aug 2026 06:16:12 -0300 Subject: Prepare for new tracing and tidy up testing Main stuff was moved into base so that I can better incorporate tracing in the future. I'm thinking it will involve modifying new and bind. --- base.lisp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'base.lisp') diff --git a/base.lisp b/base.lisp index 7c72501..5531562 100644 --- a/base.lisp +++ b/base.lisp @@ -18,6 +18,22 @@ (deftype parser () `(function (cursor) result)) +(declaim (ftype (function (parser string) result) parse)) +(defun parse (parser data) + (funcall parser (make-cursor :data data))) + +(defmacro defparser (name args parser) + (let ((message (format nil "In ~a:~&" name))) + (if (and (listp args) (every #'symbolp args)) + (let (definition) + (when (= (length args) 0) + (push `(defparameter ,name (,name)) definition)) + (push `(defun ,name (,@args) ,parser) + definition) + (push 'progn definition) + definition) + (error "Malformed argument list.")))) + (defmacro lazy (parser &rest args) (let ((input (gensym))) `(the parser -- cgit v1.2.3