From 270f6100b7f161c4db9d4af403edecdfa40b3cd4 Mon Sep 17 00:00:00 2001 From: Scott Richmond Date: Sat, 19 Mar 2022 19:08:12 -0400 Subject: [PATCH] Add a stub of a static analyzer. --- src/ludus/analyzer.clj | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 src/ludus/analyzer.clj diff --git a/src/ludus/analyzer.clj b/src/ludus/analyzer.clj new file mode 100644 index 0000000..366aca4 --- /dev/null +++ b/src/ludus/analyzer.clj @@ -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 +") \ No newline at end of file