A melody generator based on grammars