Python实现的LISP子集.
>>> from b import BilibilispParser
>>> pr = BilibilispParser()
>>> exp = '(* 3 (+ 4 5))'
>>> pr.parse(exp)
27
>>> exp = '(var a 9 (* a a))'
>>> pr.parse(exp)
81
>>> exp = '((lambda x (* x 3)) 2)'
>>> pr.parse(exp)
6
>>> exp = '(var y 4 ((lambda x (* x y)) 2))'
>>> pr.parse(exp)
8
更多用例见test.py.
怎样写一个解释器 by 王垠