updated CFG class, fixed error in finiteautomaton.h