Minilisp.pm/test.pl

19 lines
277 B
Perl

use lib "./lib";
use Minilisp;
use Data::Dumper;
my $term = <<EOF;
(defun fact (n) (if (> n 1) (* n (fact (- n 1))) 1))
(write-line (fact 5))
EOF
my $parsed = Minilisp::compile($term);
my $ctx = {
'a' => "bar",
};
print "$term\n";
print ":= " . $parsed->($ctx) . "\n";