> On 17 Nov 2017, at 14:10 , Thierry Goubier <thierry.goub...@gmail.com> wrote: > > > there is an 'E O F' token generated by SmaCC; I haven't tried to use it in a > parser yet.
I tried patching the tokenActions table to trap on this, but the token id for E O F is outside of the range of the table. The Python example that you pointed me to is a little different. It overrides scannerError, and explicitly adds a newline token if there is an error at the end of the file. It doesn’t actually use the E O F token, but it is probably a pattern that I can steal. In the meantime, I made the final StatementSeparator (<newline> or ";") optional in all the productions. The grammar is a bit ugly, but the parser is cleaner. I also gave up trying to eliminate intermediate parseTree nodes. Instead, I eliminated intermediate productions form the grammar. This makes the grammar more ugly (it has several repetitions where I inlined the intermediate productions), but the tree construction is a lot more straightforward. Andrew