Lyricdev
GitHub

LYR-PAR0045

nesting deeper than the parser carries

error · spec 02-grammar

Expressions or types in a file nest deeper than this implementation parses — 192 levels of parentheses, brackets, operands or type arguments. Reported once, and the file is then read as holding no declaration.

Explanation

The language sets no limit on nesting; the parser recurses, and a thread's stack does not grow without end. Rather than crash, the parse stops at a fixed depth and says so. No written program comes near it; a generated one can.

Split the expression: give inner parts names with let, or build the value in steps.

Wrong

//- src/main.lyr
import app.deep;
fn main(): void {
}
//- src/deep.lyr
pub fn deep(): int {
    return ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((1))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))));
}
//- src/main.lyr
import app.deep;

fn main(): void {
    let _ = deep.deep();
}
//- src/deep.lyr
pub fn deep(): int {
    return 1;
}