From e8dfcee463d771c21c513dea4af30c5c51a2525e Mon Sep 17 00:00:00 2001 From: colin Date: Sat, 29 Jul 2023 09:19:39 -0700 Subject: more of the same --- examples/calc.lisp | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'examples/calc.lisp') diff --git a/examples/calc.lisp b/examples/calc.lisp index 7b2f9ef..4d8766a 100644 --- a/examples/calc.lisp +++ b/examples/calc.lisp @@ -6,21 +6,29 @@ (in-package #:argot.examples.calc) (deflanguage calc (:documentation "A calculator language") - ( :-> (:or - (:seq (:eof)) - (:seq (:eof)) - (:seq (:eof)) - (:seq (:eof))) - :then car) - ( :-> (:or )) - ( :-> (:item) - :if listp - :then (argot:parse calc )) - ( :-> (:item) :if numberp) - ( :-> (:seq (:@ lhs ) - (:@ rhs (:+ (:seq (:or= + - / * ^ %) )))) - :then (expand-binop lhs rhs)) - ( :-> (:seq (:or= sin cos tan -) ))) + ( + :match (:or + (:seq (:eof)) + (:seq (:eof)) + (:seq (:eof)) + (:seq (:eof))) + :then car) + ( + :match (:or )) + ( + :match (:item) + :if listp + :then (argot:parse calc )) + ( + :match (:item) + :if numberp) + ( + :match (:seq + (:@ lhs ) + (:@ rhs (:+ (:seq (:or= + - / * ^ %) )))) + :then (expand-binop lhs rhs)) + ( + :match (:seq (:or= sin cos tan -) ))) (defun lassoc? (op) -- cgit v1.2.3