Better handling of missing/misplaced EOF tokens and other extra tokens

Better handling for cases like:
P(a) P(b) $
x = 2 $ x = 3