Added functions to grammar.
Better nesting support in grammar.