Quote: "
True it has less work to do if it only works up to one error; but would the task take more time and effort if say a 5 minute compile of 30-40k lines made obvious which error is the first one, and what categories each error fall under; warning, parenthesis error, parameter error, type field error, etc. rather than doing the compile job waiting for it to spot one error? I would have thought that would save more time, but you found it to be more problematic?
"
Returning multiple errors isn't any more difficult. The parser breaks down into a single loop really that exits when the error state is set. To return more than one error, just add the error messages together, flush the state and continue on. There needs to be maximum error count though.
The only negative is cascading errors become more likely, where say error #1 is causing error #2 and so on down the line. These generally occur as a by product of some structural mistake, which should force an exit anyway.
ie.
Type GameObject
fields and stuff
EndTpe
20 K lines follow...
So a missing closing statement like this, ends up spiting out every line thereafter as an error. Which can be pretty annoying.
It works much better for stuff line this though,
MyFunction(10,20,30)
MyFunction(10,20,30)
MyFunction(10,20,30)
MyFunction(10,20,30)
Function MyFunction(A,b,c,d)
do stuff
EndFunction
Say a programmer adds the
d parameter to this function and re compiles, now each call of the function will pop out some type of parameter mismatch in the error list. Which is pretty handy.
Quote: "5 minute compile of 30-40k lines "
40K lines is only 4->5 second build time, even in legacy PlayBASIC, so thankfully we don't have that problem.