Automating the Finite Element Method