1. A compiler system for compiling source code comprising: a library of code patterns and control flow information for each code pattern, wherein each code pattern comprises one or more variable; and a processor arranged to: evaluate the control flow of an expression in the source code, wherein the expression comprises one or more variable, match the expression to one of the code patterns in the library based on the evaluated control flow information, assign value numbers to the one or more variable within the expression, determine if the expression and the matched code pattern are equivalent based on the assigned value numbers, and replace the expression with a replacement expression if the expression and the matched code pattern are equivalent.