writing .y .lex generation function