if (false && okeoefkepofke[3.141592])
Why can't you check that using a float as an array index is a syntax error, no matter if it's going to be evaluated or not?Are multi-pass compilers not a thing any more?
if (false && okeoefkepofke[3.141592])
Why can't you check that using a float as an array index is a syntax error, no matter if it's going to be evaluated or not?Are multi-pass compilers not a thing any more?
a) a compiler that can recover from errors and continue to parse the rest of a file, to produce an AST of all the parts that make sense but error nodes for the bits that don't.
b) a compiler that can optionally not run some passes (like typechecking) so that an editor/treesitter can get an understanding of the structure of the code, but an actual compile will do more. (Actually, this should already happen, so language servers don't do optimisation or IL/bytecode/asm generation passes.)
TIL.
I just checked and it doesn't do that, so if it's just doing enough for syntax highlighting, yeah, a custom parser is probably the best way to go about that. Thanks.