Lisp in Perl (2015)
  • Perl 57.8%
  • Common Lisp 39.7%
  • NewLisp 1.7%
  • Makefile 0.8%
Find a file
Juergen Nickelsen fa4d3f0855 added qq.lisp
2017-06-22 18:11:19 +02:00
l added qq.lisp 2017-06-22 18:11:19 +02:00
tests adapted min/max test cases to changed min/max implementation 2015-07-10 16:17:30 +02:00
.gitignore mandatory defvar for globals; -s for Perl stacktraces on error; cleanup 2015-07-06 09:44:16 +02:00
Builtin.pm straightened and simplified error handling all over the place 2015-07-10 16:46:54 +02:00
Debug.pm upped the perl use from 5.010 to 5.014 2015-07-07 11:46:54 +02:00
Eval.pm straightened and simplified error handling all over the place 2015-07-10 16:46:54 +02:00
Fundamental.lisp fixed shameful min/max blunder, which made them ignore half their arguments 2015-07-10 16:20:38 +02:00
Global.pm some half-baked improvements re error handling and reporting 2015-07-09 23:27:21 +02:00
Interp.pm straightened and simplified error handling all over the place 2015-07-10 16:46:54 +02:00
LICENSE.md added LICENSE, removed example (enough in Fundamental anyway) 2015-06-16 10:12:12 +02:00
Lis.pl rename Sexp -> Object 2015-07-09 11:48:16 +02:00
Makefile time the mandatory test run before pushing 2015-07-10 16:48:19 +02:00
Object.pm straightened and simplified error handling all over the place 2015-07-10 16:46:54 +02:00
Print.pm rename Sexp -> Object 2015-07-09 11:48:16 +02:00
Read.pm straightened and simplified error handling all over the place 2015-07-10 16:46:54 +02:00
README.md small README addition 2015-09-08 10:16:01 +02:00
TODO TODO update 2015-07-09 10:09:52 +02:00
Util.pm straightened and simplified error handling all over the place 2015-07-10 16:46:54 +02:00

-- text --

A Lisp in Perl

Because we can! Writing a Lisp interpreter not in a language I am currently learning, but relatively familiar with shifts the "how do I do this" thinking from "... at all" to "... in the most convenient/elegant/best of all ways". That doesn't mean it is easier. Still, I get to learn new things about Perl all the time.

The Lisp dialect implemented here is closely related to that of the "lingo" implementation -- mostly traditional, names from Maclisp or Common Lisp, mandatory defvar for global variables. It is different in having fewer datatypes (vectors, tables, ports) and no file I/O, but mainly by using lexical scope for bindings, which has the great advantage of enabling closures. (I love closures!)

The implementation is quite simple. In particular it is a very naive interpreter that does the same things over and over, not a hint of optimization or the like, just like "lingo". (It does about 35000 evals/s on my laptop, which is not exactly fast.) Still it is fun to play with it and try things out.

It is probably possible to make this implementation more idiomatic in terms of Perl idioms. It shows that I am not really a "Perl programmer" who knows the ins and outs of Perl and how to apply them best, but a programmer in general with some working knowledge of Perl who could have done this in some other language just as well. Oh, wait, I did...