-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathlispython.py
More file actions
43 lines (35 loc) · 1.68 KB
/
Copy pathlispython.py
File metadata and controls
43 lines (35 loc) · 1.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# -*- coding: utf-8 -*-
"""Lispython: The love child of Python and Scheme.
Powered by `mcpyrate` and `unpythonic`.
"""
__all__ = ["Lispython"]
__version__ = '2.0.0'
from mcpyrate.quotes import macros, q # noqa: F401
from mcpyrate.dialects import Dialect
from mcpyrate.splicing import splice_dialect
class Lispython(Dialect):
"""**Schemers rejoice!**
Multiple musings mix in a lambda,
Lament no longer the lack of let.
Languish no longer labelless, lambda,
Linked lists cons and fold.
Tail-call into recursion divine,
The final value always provide.
"""
def transform_ast(self, tree): # tree is an ast.Module
with q as template:
__lang__ = "Lispython" # noqa: F841, just provide it to user code.
from unpythonic.syntax import (macros, tco, autoreturn, # noqa: F401, F811
multilambda, quicklambda, namedlambda, f,
where,
let, letseq, letrec,
dlet, dletseq, dletrec,
blet, bletseq, bletrec,
local, delete, do, do0,
let_syntax, abbrev, block, expr,
cond)
from unpythonic import cons, car, cdr, ll, llist, nil, prod, dyn, Values # noqa: F401, F811
with autoreturn, quicklambda, multilambda, tco, namedlambda:
__paste_here__ # noqa: F821, just a splicing marker.
tree.body = splice_dialect(tree.body, template, "__paste_here__")
return tree