polish parser and checking a bit more

most structures record their location in the source file, for
better error messages

better checking of orphan/dupe/missing menus

shuffle structure definitions into parse.y