Add a stub of a static analyzer.

This commit is contained in:
Scott Richmond 2022-03-19 19:08:12 -04:00
parent 7a2fabd131
commit 270f6100b7

18
src/ludus/analyzer.clj Normal file
View File

@ -0,0 +1,18 @@
(ns ludus.analyzer
(:require
[ludus.ast :as ast]
[ludus.token :as token]))
(defn analyze [ast] ast)
(comment "
Here's where we do a bunch of static analysis.
Some things we might wish for:
* No unused bindings
* No unbound names
* Compound `loop` and `gen` forms must have LHS's (tuple patterns) of the same length
* Recur must be in tail position in `loop`s
* Tail call optimization for simple recursion (rewrite it as a loop?)
* Check arities for statically known functions
* Enforce single-member tuple after called keywords
")