Add training tool for the shift-reduce parser.

Also add functions to save/restore from model files.