Glossary · Automation software engineering and architecture
Compiler
German: Compiler
In software engineering, a compiler is a program that translates source code written in a programming language into another form, usually machine code, bytecode or an intermediate representation, before the program is executed. PLC engineering tools contain compilers that translate IEC 61131-3 languages into code for the target controller.
- Software engineering
In one sentence
A compiler translates source code into machine code, bytecode or another representation before the program is executed.
Example
Before downloading, the engineering tool compiles the structured text and ladder diagram code into native code for the controller's processor and reports two type errors.
Explained in context
Context cards connect this term with others to answer one question. Also in British English and German.
How it applies
- Engineering: The compiler checks syntax and types, optimizes code and produces output for a specific target. Compiler warnings are cheap early defect detection and should not be ignored.
- Maintenance: Compiler version and options affect the generated code. A machine's software may need to be rebuilt years later with the same compiler to reproduce a released binary, so toolchains must be archived.
- Functional safety: Where compiled code is used in safety-related systems, standards such as IEC 61508-3 set requirements for the confidence in tools, which may include using a certified or proven compiler.
- Documentation: Record compiler name, version and relevant options for each release. The documentation team should keep supported toolchain versions in integration and library documentation up to date.
Compiler vs. interpreter
A compiler translates the whole program before execution; an Interpreter executes source or intermediate code statement by statement at runtime. Many modern systems combine both, for example compiling to bytecode that is then interpreted or just-in-time compiled.