Run-time stack balance verification

From: Charles Melice <mail_at_forthcad.com>
Date: Fri, 17 Dec 1999 12:02:59 +0100

Is Anybody can propose here ideas ( or a solution ) to have a reliable
system to check the stack balance, optionally and at run-time ?

A system such as:

        CHECK-STACK ON

        : W1 ( a b -- c ) ... ;

        : W2 ( b -- c T | F ) ... ;

        : W3 ( s: a b -- c ) ( f: -- x ) ... ;

        ( hello -- ) \ out of subject - not follow a definition

        CHECK-STACK OFF

In the first case, if (DEPTH-EXIT - DEPTH-ENTRY) <> 1, or if
(DEPTH-ENTRY<2), we throw an error.

        : W1 ( a b -- c ) 2DROP ; \ will throw
        : W1 ( a b -- c ) 45 + ; \ will throw

I don't know if its possible to assume the stack schema W2, W3. Those cases
can be discarted in first approach.

Regards,
____________
Charles Melice
mail_at_forthcad.com
www.forthcad.com

.
Received on Fri Dec 17 1999 - 12:02:59 PST


Subscribe to our e-mail list service. It's free for all SwiftForth and SwiftX users!

This archive was generated 09-Feb-2012. Archive updated nightly.