Macro Expansions

A.0.1  Comparisons

(<  a b)  => (seq (cmp a b) l!)
(<= a b)  => (seq (cmp a b) le!)
(>  a b)  => (seq (cmp a b) g!)
(>= a b)  => (seq (cmp a b) ge!)
(=  a b)  => (seq (cmp a b) e!)
(!= a b)  => (seq (cmp a b) ne!)
(zero? a) => (seq (test a a) z!)

A.0.2  More Control Primitives

Though these are described in The Text Section as control ``primitives,'' they are actually macros.

(alt a b ...) => (inv (seq (inv a)
                           (inv b)
                           ...))

(times n e)   => (begin e e ...) ; There will be n e's

(until test body) => (while (inv test) body)

A.0.3  ELF helpers

_global_offset_table => _GLOBAL_OFFSET_TABLE_ ; an uppercase symbol

get-got => (seq (call $eip)
                (pop ebx)
                (add ebx (reloc gotpc the-got 3))

(got-offset symbol values ...) => (reloc gotoff symbol (! (+ 0 values ...)))
(got symbol) => (reloc got32 symbol)
(plt symbol) => (reloc plt32 symbol)
(sym symbol) => (reloc sym32 symbol)

A.0.4  Explicit Continuation Versions

The following macros use only explicit continuations to express the semantics of the primitives seq, if, inv, and begin. They are included in the documentation for elucidation, but are not part of Sassy's core set of macros:

(macro seq-k (lambda tests
	       (cond ((null? tests) '$win)
		     ((null? (cdr tests)) (car tests))
		     (else `(with-win (seq-k ,@(cdr tests))
			      ,(car tests))))))

(macro inv-k (lambda (itm)
	       `(with-win-lose $lose $win
		  ,itm)))

(macro if-k (lambda (test conseq altern)
	      `(with-win-lose ,conseq ,altern
		 ,test)))

(macro begin-k (lambda body-tail
		 (if (null? (cdr body-tail))
		     (car body-tail)
		     `(with-win (begin-k ,@(cdr body-tail))
			(with-lose $win
			  ,(car body-tail))))))