bitcoin-sv / sol2scrypt

Solidity to sCrypt Transplier
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Transpile loop #126

Closed xhliu closed 2 years ago

xhliu commented 2 years ago

while/for

xhliu commented 2 years ago
// this must be manually configured at compile time
static const int N0 = __$$__;

loop (N0) {

}
xhliu commented 2 years ago

log level: FATAL?

xhliu commented 2 years ago

How to report error location, in sCrypt, not in Solidity?

xhliu commented 2 years ago
        // (1)
        for (init; predicate; update) {
            body;
        }

        //==>

        init;
        loop (N) {
            if (predicate) {
                body;
            }
            update;
        }

        //(2)
        while (predicate) {
            body;
        }

        //==>

        loop (N) {
            if (predicate) {
                body;
            }
        }

        //(3) 
        do {
            body;
        } while (predicate);

        //==>

        body;
        loop (N) {  // N: # of actual loop - 1
            if (predicate) {
                body;
            }
        }
*/