added functions to grammar