module main struct ComparisonCase { name string source string expected_tokens int // includes Vile's EOF expected_forms int // Blip top-level forms } // Restrict the corpus to syntax both projects support. In particular, bounded // decimal integers avoid silently benchmarking Blip's symbol fallback for a // huge integer that it cannot represent. fn comparison_cases(size int) []ComparisonCase { integers := '123 -456 7890 0\n' integer_repeats := size / integers.len + 1 form := '(define (square x) (+ (* x x) 123))\n' form_repeats := size / form.len + 1 quoted := "'(alpha 123 (beta gamma))\n" quoted_repeats := size / quoted.len + 1 identifiers := 'alpha betaGamma list->vector a.b c@d set! <= call/cc x9\n' identifier_repeats := size / identifiers.len + 1 varied_identifier := 'Ab9!\$%&*/:<=>?^_~+-.@' return [ ComparisonCase{'identifier', 'a'.repeat(size), 2, 1}, ComparisonCase{'varied-id', varied_identifier.repeat(size / varied_identifier.len + 1), 2, 1}, ComparisonCase{'short-ids', identifiers.repeat(identifier_repeats), 9 * identifier_repeats + 1, 9 * identifier_repeats}, ComparisonCase{'integers', integers.repeat(integer_repeats), 4 * integer_repeats + 1, 4 * integer_repeats}, ComparisonCase{'string', '"' + 'x'.repeat(size) + '"', 2, 1}, ComparisonCase{'comment', ';' + 'x'.repeat(size) + '\n', 1, 0}, ComparisonCase{'mixed', form.repeat(form_repeats), 16 * form_repeats + 1, form_repeats}, ComparisonCase{'quoted', quoted.repeat(quoted_repeats), 9 * quoted_repeats + 1, quoted_repeats}, ] }