hara.common.grammar-macro

+op-macro+

+op-macro-arrow+

+op-macro-case+

+op-macro-forange+

+op-macro-let+

+op-macro-xor+

tf-case

added in 4.0

(tf-case [_ val & options])

transforms the case statement to switch representation

tf-cond

added in 3.0

(tf-cond [_ check then & more])

transforms cond to branch

tf-do-arrow

added in 4.0

(tf-do-arrow [_ & body])

do:> transformation

(tf-do-arrow ’(do:> 1 2 (return 3))) => ’((fn [] 1 2 (return 3)))

tf-doto

added in 4.0

(tf-doto [_ sym & forms])

basic transformation for doto syntax

tf-forange

added in 4.0

(tf-forange [_ [type? sym size params] & body])

creates the forange form

(tf-forange ’(forange i 10(print i))) => ’(for [(var i 0) (< i 10) (:= i (+ i 1))] (print i))

(tf-forange ’(forange [i 10 3 -2] (print i))) => ’(for [(var i 10) (< i 3) (:= i (- i 2))] (print i))

tf-if

added in 3.0

(tf-if [_ check then & [else]])

transforms if to branch

(tf-if ’(if true :A :B)) => ’(br* (if true :A) (else :B))

tf-lambda-arrow

added in 4.0

(tf-lambda-arrow [_ & more])

generalized lambda transformation

tf-let-bind

added in 4.0

(tf-let-bind [_ bindings & body])

converts to a statement

tf-macroexpand

added in 3.0

(tf-macroexpand form)

macroexpands the current form

tf-tcond

added in 4.0

(tf-tcond [_ & more])

transforms the ternary cond

(tf-tcond ’(:?> :a a :b b :else c)) => ’(:? :a [a (:? :b b c)])

tf-when

added in 3.0

(tf-when [_ check & body])

transforms when to branch

(tf-when ’(when true :A :B :C)) => ’(br* (if true :A :B :C))

tf-xor

added in 4.0

(tf-xor [_ a b])

transforms to xor using ternary if

(tf-xor ’(xor a b)) => ’(== (not (not a)) (not (not b)))