<commit_before>
// sdk
import structs/[ArrayList, List]

version (windows) {
    RaiseException: extern func (ULong, ULong, ULong, Pointer)
}

foo: func {
    // SIGSEGV
    /*
        f: Int* = null
        f@ = 0
    */

    // SIGFPE
    /*
        a := 30
        b := 0
        a /= b
    */

    // Win32 exception
    /*
        RaiseException(0, 0, 0, null)
    */

    // ooc exception
    /*
        a := ArrayList<Int> new()
        a[0] toString() println()
     */
}

bar: func {
    foo()
}

main: func {
    app := App new()
    app run()
    0
}

App: class {
    init: func

    run: func {
        version (debug) {
            "Running in debug!" println()
        } else {
            "Running in release!" println()
        }
        
        "> Printing a gratuitious backtrace" println()
        Exception getCurrentBacktrace() println()

        "> Now looping. If it doesn't crash, use Ctrl-C to send SIGINT!" println()

        loop(||
            runToo()
        )
    }

    runToo: func {
        bar()
    }
}
<commit_msg>Sleep, and return true on loop otherwise it breaks prematurely. silly me :D<commit_after>
// sdk
import structs/[ArrayList, List]
import os/Time

version (windows) {
    RaiseException: extern func (ULong, ULong, ULong, Pointer)
}

foo: func {
    // SIGSEGV
    /*
        f: Int* = null
        f@ = 0
    */

    // SIGFPE
    /*
        a := 30
        b := 0
        a /= b
    */

    // Win32 exception
    /*
        RaiseException(0, 0, 0, null)
    */

    // ooc exception
    /*
        a := ArrayList<Int> new()
        a[0] toString() println()
    */

    // no crash? sleep and try again later
    "Sleeping..." println()
    Time sleepSec(2)
}

bar: func {
    foo()
}

main: func {
    app := App new()
    app run()
    0
}

App: class {
    init: func

    run: func {
        version (debug) {
            "Running in debug!" println()
        } else {
            "Running in release!" println()
        }
        
        "> Printing a gratuitious backtrace" println()
        Exception getCurrentBacktrace() println()

        "> Now looping. If it doesn't crash, use Ctrl-C to send SIGINT!" println()

        loop(||
            runToo()
            true
        )
    }

    runToo: func {
        bar()
    }
}

{'fraction_non_alphanumeric': 0.1300174520069808, 'fraction_numerical': 0.010034904013961605, 'mean_word_length': 1.436769394261424, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6577701', 'n_tokens_mistral': 785, 'n_tokens_neox': 742, 'n_words': 218}