Compilation passes

  1. Source

  2. Source with macros expanded (propel-expand.rkt)

  3. Source with syntax forms expanded (player.pos.x, #%app, etc; propel-syntax.rkt)

  4. Resolved names (propel-names.rkt)

  5. Resolved types (propel-types.rkt)

How to implement a new pass

You can start from this basic template:

(define (my-pass stx)
  (define rec my-pass) ; recurse
  ;; (printf "my-pass ~a\n" (syntax-e stx))

  (datum->syntax stx
    (match (syntax-e stx)
      ;; TODO: custom rules here

      ;; handle forms recursively
      [(? list? exprs) (map rec exprs)]
      ;; pass everything else unchanged
      [_ stx])
    stx))

Ideally the recursion logic could be factored out into a function.