Grammar learning on code