If your `stack` and `p` are defined globally and at the beginning (before 
`PUSH` and `POP` procs), you can do as simple as:
    
    
    var
      stack: array[10, int]
      p = -1
    
    proc PUSH(v: int) =
      inc p
      stack[p] = v
    
    proc POP: int =
      result = stack[p]
      dec p
    
    proc main =
      PUSH 1
      PUSH 7
      let v = POP()
      echo v
    
    main()
    
    
    Run

Reply via email to