diff --git a/lisp.modal b/lisp.modal new file mode 100644 index 0000000..d082cd4 --- /dev/null +++ b/lisp.modal @@ -0,0 +1,13 @@ +define nil () +define (pair (?x) (?y)) ((?x ?y)) +define (first (?x ?y)) (?x) +define (second (?x ?y)) (?y) + +define (quote ?x) (quote ?x) +define (if ?c ?t else ?f) (if/else ?c quote ?t quote ?f) +define (if/else (true) quote (?t) quote (?f)) (?t) +define (if/else (false) quote (?t) quote (?f)) (?f) + +define (hello) (bye) + +pair (pair (foo) (nil)) (baz) \ No newline at end of file diff --git a/modal.py b/modal.py index bbd8e0b..7762ef2 100644 --- a/modal.py +++ b/modal.py @@ -305,7 +305,7 @@ def run(rules, queue, limit=pow(2, 32)): result, queue = operation(queue, rules, pattern, *parameters) if result == True: failures = 0 - #print("<>: ", inspect(seek(queue, ["SRT"]))) + print("<>: ", inspect(seek(queue, ["SRT"]))) #print("<>: ", inspect(queue)) #input() steps = steps + 1 diff --git a/test.modal b/test.modal index f6632c4..44f5e43 100644 --- a/test.modal +++ b/test.modal @@ -1,4 +1,7 @@ define nil ((0)) -define (cons ?x (?y)) ((?x ?y)) -define (car (?x)) ?x +define (pair (?x) (?y)) ((?x ?y)) +define (first (?x ?y)) (?x) +define (second (?x ?y)) (?y) +define (quote ?x) (quote ?x) +define test (first pair (A) (pair (B) (pair (C) nil))) \ No newline at end of file