I'm writing a type checker for Clojure code that utilizes a modified version ClojureScript analyzer.
I have made some changes to the analyzer to analyze Clojure code, instead of ClojureScript.
These changes could form the basis of a generalized analyze library to be called a la carte.
- The ClojureScript compiler could use this more general library
- Should keep in mind ClojureScript's usage
Differences in 'ns syntax
- Unqualified :use and :require are legal in Clojure
- :use/require-macros don't exist in Clojure
Resolving macro expanders
- Should look for macro expanders in :use and :require instead of :use-macros and :require-macros
Keeping metadata on fn args
- Something I found helpful for annotating types. Possibly alternative strategy
Remove namespace substitution of 'cljs.core from 'clojure.core
- All vars that resolve to clojure.core have their namespace substituted for cljs.core
- (def ^:dynamic *subst-clojure-core-ns* 'clojure.core)
Analyzer doesn't understand macros (defmacro's)
- The analyzer doesn't define a new macro when parsing/analyzing a defmacro form
Initial Namespacing Environment
- Should be clojure.core and clojure.user, instead of cljs.core/user
Munging js-reserved symbols
- Special case not applicable to Clojure