don't use lex and yacc
Instead use flex and bison which are almost certainly present. They are almost identical to lex and yacc (have a few extensions). If you still have problems, you will have to check the development tools section of the "add software" (or whatever) utility, and make sure that flex and bison are installed..