Error message instead of triggering assertion on certain syntax errors

When functions were used without arguments or arrays without indexes an assertion was triggered. Now an error message is printed.