improved error reporting for the CLI frontend. Now error lines will be reported and the process will exit with an error return code instead of just throwing a stack trace.
fixed a typo in the prettyprinter.
fixed logic that was misnesting loops.