<commit_before>
import frontend/ParsingPool
import middle/Resolver
import backend/c89/C89Backend

main: func (argc: Int, argv: CString*) {

    if(argc <= 1) {
        "Usage: oc file.ooc" println()
        exit(1)
    }
    
    pool := ParsingPool new()
    mainJob := ParsingJob new(argv[1] toString(), null)
    pool push(mainJob)
    pool exhaust()
    mainJob module main? = true

    Resolver new(C89Backend new(), mainJob module) start()
    
}
<commit_msg>Use rofl0r's fantastic text/Opts to avoid crashing loudly when using options :D<commit_after>
import structs/ArrayList
import frontend/ParsingPool
import middle/Resolver
import backend/c89/C89Backend
import text/Opts

main: func (args: ArrayList<String>) {

    opts := Opts new(args)

    if(opts args size <= 1) {
        "Usage: oc file.ooc" println()
        exit(1)
    }
    
    opts args each(|arg|
        compile(arg, opts)
    )
    
}

compile: func (file: String, opts: Opts) {
    
    pool := ParsingPool new()
    mainJob := ParsingJob new(file, null)
    pool push(mainJob)
    pool exhaust()
    mainJob module main? = true

    Resolver new(C89Backend new(), mainJob module) start()
    
}

{'fraction_non_alphanumeric': 0.11158432708688246, 'fraction_numerical': 0.015332197614991482, 'mean_word_length': 2.9166666666666665, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 4, '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': '2526028', 'n_tokens_mistral': 395, 'n_tokens_neox': 386, 'n_words': 112}