reorganized grammar parser, added 'first rule' generation