Add functions returning functions to the grammar