Croissant Runtime
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
crsn/examples/stacks.csn

36 lines
507 B

(
(stack r0)
(push @r0 1)
(push @r0 2)
(pop r1 @r0)
(cmp r1 2 (ne? (fault)))
(pop r1 @r0)
(cmp r1 1 (ne? (fault)))
; test reverse push
(push @r0 '🐈')
(push @r0 7)
(rpush @r0 8)
(pop r1 @r0)
(cmp r1 7 (ne? (fault)))
(pop r1 @r0)
(cmp r1 '🐈' (ne? (fault)))
(pop r1 @r0)
(cmp r1 8 (ne? (fault)))
; test reverse pop
(push @r0 1000)
(push @r0 2000)
(rpop r1 @r0)
(cmp r1 1000 (ne? (fault)))
(del @r0)
)