Array implementation of Stack

S

Shao Miller

the below is one much better language

<< top=0, size=4, arr=8, notUsed=12

;0k,4j,8i,12ra, 16P_v, 20P_sz
IniStack:
<i,j,k
i=^16 |j=^20
i==0#.e|j<=0?#.e|D*i=0|#.1
.e: a=-1|stc|#.z
.1: malloc<(16)|a==0#.e|k=a
a=j|c=8 |mul c|r#.2
malloc<(a) |a==0!#.3
.2: free<(k)|#.e
.3: *i=k
D*k+top=-1|D*k+size =j
D*k+arr= a|D*k+notUsed=0
a^=a ; => CF==0
.z:
ret 8
etc etc

If you tilt your head sideways, it looks like a crab[1].

[1] http://en.wikipedia.org/wiki/File:Liocarcinus_vernalis.jpg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,091
Messages
2,570,604
Members
47,223
Latest member
smithjens316

Latest Threads

Top