difference between an Assembler and a Compiler?

Compiler is a computer program that reads a program written in one language and translates it in to another language, while an assembler can be considered a special type of compiler which translates only Assembly language to machine code. Compilers usually produce the machine executable code directly from a high level language, But assemblers produce an object code which might have to be linked using linker programs in order to run on a machine. Because Assembly language has a one to one mapping with machine code, an assembler may be used for producing code that runs very efficiently for occasions in which performance is very important (for e.g. graphics engines, embedded systems with limited hardware resources compared to a persona computer like microwaves, washing machines, etc.).