A compiler is a program used to transform one [[Program]] to another. This is typically the case of converting an (*alledgely*) human readable [[Programming Language]] like [[C++]] or [[C]] into a binary language for a target [[CPU]]. Other forms exist as well, such as the [[Typescript#Compiler|Typescript Compiler (tsc)]] which converts [[Typescript]] into [[Javascript]].
>[!example]
>![[../../00 Asset Bank/Pasted image 20250724174417.png|invert_S]]
## Stages
- The *frontend* of a compiler tends to be the parts that is in charge of [[Lexical Analysis]] and [[Semantic Analysis]].
- The *middle-end* (if present) is typically converting the validated & parsed program into some form of intermediate representation ([[IR Code]]), and may do optimizations on that code.
- The *backend* of a compiler is responsibily for converting the frontend, or [[IR Code]] (if present) into optimised machine code that can be exected by the target platform.