2021-12-29 16:49:49 +00:00
|
|
|
; https://github.com/munificent/craftinginterpreters/blob/master/test/closure/closed_closure_in_function.lox
|
|
|
|
|
|
|
|
(define f #f)
|
|
|
|
|
|
|
|
((lambda ()
|
|
|
|
(define local 1)
|
|
|
|
(define (f_)
|
|
|
|
(display local))
|
|
|
|
(set! f f_)))
|
|
|
|
|
|
|
|
(f)
|
Some HIR
```python
x = """Lambda,
If,
Set,
Define,
Cond,
Case,
And,
Or,
When,
Unless,
Begin,"""
x = x.replace(" ", "").replace(",", "").replace("\r", "")
x = x.splitlines()
print("// ===== Begin Special Forms =====")
for i in x:
i = i.lower()
print(f"fn sf_{i}<'a>(&mut self, tree: &[Ast<'a>]) -> Option<Hir<'a>> {{")
print("todo!()")
print("}")
print("// ===== End Special Forms =====")
```
2022-01-01 18:38:43 +00:00
|
|
|
|
|
|
|
|
|
|
|
(fffo
|
|
|
|
(ddssd))
|
|
|
|
|
|
|
|
(define (fx)
|
|
|
|
(+ x x))
|
|
|
|
|
|
|
|
(defin)
|
|
|
|
|
|
|
|
(def)
|
|
|
|
|
|
|
|
(define (f x)
|
|
|
|
(+ 2 3 4 x))
|