Skip to content

Instantly share code, notes, and snippets.

@udoprog
Last active August 29, 2015 14:04
Show Gist options
  • Select an option

  • Save udoprog/cca8d3c24b081c1d6d49 to your computer and use it in GitHub Desktop.

Select an option

Save udoprog/cca8d3c24b081c1d6d49 to your computer and use it in GitHub Desktop.
; entry := [] [[:+, 10, [:hello, 33]]]
LDC 10
LDC 33
LDF 10
AP 1 ; hello
ADD
RTN
; __let1 := [:f] [[:+, :f, :foo]]
LD 0 0 ; f
LD 1 0 ; foo
ADD
RTN
; hello := [:foo] [[:if, [:<, 42, :foo], [:let, [:f, 10], [:+, :f, :foo]], 20]]
LDC 42
LD 0 0 ; foo
CGTE
LDC 0
CEQ
SEL 17 21
RTN
LDC 10
LDF 6
AP 1 ; __let1
JOIN
LDC 20
JOIN
(defn hello (foo)
(if (< 42 foo)
(let (f 10)
(+ f foo))
20))
(defentry ()
(+ 10 (hello 33)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment