Skip to end of metadata
Go to start of metadata


The Clojure compiler is currently a large Java class. Writing it in Clojure will produce many benefits.


  • Provide discrete analysis phase yielding Clojure data structures capturing semantics of code.
  • Split out type reflection into API
    • needs protocols to hide actual reflection classes
      • since we would like to fabricate class and method descriptors for classes-being-compiled
  • Split out code gen into API
  • Split off ASM into separate jar
    • allow for full use of ASM
      • e.g. show assembly output mode for compiler
    • this split could happen pre-CinC
    • Should we still re-root package to avoid conflicts?
  • Multiple back ends
    • Java source
    • Java bytecode
    • CLR
    • JS
    • ?
  • Remove warts from current design
    • e.g. use of vars and binding
    • explicitly pass environment
      • current code modifies environment to e.g. tag things as closed-over
        • could turn into query against child tree
        • in any case, will need to take and return environment (in addition to returning expression object)
    • some rewriting is done during analysis in order to facilitate generation
      • e.g. wrapping things in lambdas to get around expression restrictions
      • should/could this be done later, during gen?
        • since different targets might have different approaches
  • Some impacts on current infrastructure
    • e.g. namespaces map to vars or classes
      • need to map to class descriptors in order to be able to resolve to things-being-compiled