I'm going to take this on just for fun...
Yep, just fun and games
1) That assumes there are
- no optional param / param with default value
- overloads
- () are mandatory for functions
2) "if b is a record" => does not exclude the other cases, if we consider operator overloads (as then a record + some_other_type would be possible)
3) Yes a semicolon could make that correct, if the following "c" is a function (since the result does not need to be consumed, it would be a statement)
4) Yes the "extra space" wasn't serious / so is the missing comment-start
So for the given
if true then A := b c
consider
b and c are functions
b is overloaded (or has a default param)
b returns a structure
there is an overloaded + for that structure type
Ok, yes: not the average case....
However, on the more serious note, if trying to narrow it down... I uphold an unspecific error ("semicolon missing" is not unspecific) is better that the wrong specific.
Some of your suggestion on finding the error assume that the error is in the next token. But if "b" was already wrong, then any specific error found will sent the user on the wrong path. And for a user, especially a not-so-expert it does not matter what rules the compiler used to determine the error, if he mistyped the b.
E.g.
A := no b; /
- meant to be "not b"
- "no" may be a defined identifier
No error, whatsoever would help the user here. And any attempt to get a specific error will make it worse.
Well ChatGpt actually includes this
"The no operator is not valid in Pascal. Pascal uses not for logical negation." and even an example on the correct usage of "not".