Language translators and IDEs
| English | Chinese | Pinyin |
|---|---|---|
| source code | 源代码 | yuán dài mǎ |
| machine code | 机器码 | jī qì mǎ |
| assembler | 汇编器 | huì biān qì |
| compiler | 编译器 | biān yì qì |
| interpreter | 解释器 | jiě shì qì |
| bytecode | 字节码 | zì jié mǎ |
| virtual machine | 虚拟机 | xū nǐ jī |
| just-in-time | JIT即时编译 | JIT jí shí biān yì |
| breakpoints | 断点 | duàn diǎn |
From source code 源代码 to running program
- You write source code; the computer runs machine code 机器码.
- A translator bridges the gap — and there are three kinds.
- An IDE puts all the tools to write, run and debug code in one place.
Assembler 汇编器, compiler 编译器, interpreter 解释器
- An assembler translates assembly language to machine code, one instruction per instruction.
- A compiler translates a high-level program to machine code once, before it runs: it reports all errors at compile time, then produces a stand-alone executable that runs without the compiler and is fast at run time (but tied to one CPU/OS).
- An interpreter translates and runs one line at a time, producing no executable: it reports an error when it reaches that line, needs to be installed to run the program, and is generally slower but easy to port.

A compiler translates the whole program once into an executable; an interpreter translates and runs it line by line
The compiler route: source to running program
Step through how a compiler works — translating the whole program once, before it runs. Contrast it with an interpreter, which translates and runs one line at a time.
A compiler differs from an interpreter because it:
A compiler translates all at once into an executable that runs without the compiler. An interpreter runs line by line.
When does an interpreter report an error?
An interpreter runs line by line, so it reports an error at the moment it reaches that line — handy during development.
Match each translator to what it does.
Assembler: assembly→machine code; compiler: all-at-once to an executable; interpreter: line by line at run time.
Put the compiler route in order, from writing code to running it.
A compiler translates the whole program once into an executable; that file then runs without the compiler.
An interpreter produces no stand-alone executable, so the interpreter itself must be installed to run the program.
An interpreter translates and runs line by line each time — there is no separate executable to ship, unlike a compiler.
Choosing between them
| Use a compiler when… | Use an interpreter when… |
|---|---|
| you need maximum run-time speed | you want a fast edit-run-debug cycle |
| distributing to users without dev tools | writing cross-platform scripts |
| the program runs many times | the program is small or run-once |
You should choose a compiler when:
Compiled executables are fast and stand-alone. Interpreters suit quick development and portable scripts.
Hybrid: Java bytecode 字节码
- Java is compiled to bytecode — a platform-independent intermediate form.
- A virtual machine 虚拟机 (JVM) then interprets it, or uses just-in-time JIT即时编译 (JIT) compilation to turn hot parts into native code.
- So errors are caught early, the bytecode runs anywhere with a JVM ("write once, run anywhere"), and long-running programs reach near-native speed.

Java compiles to platform-independent bytecode, which any JVM then runs — write once, run anywhere
Java compiles to bytecode that runs on a JVM. The main benefit is:
Bytecode is platform-independent; any JVM can run it (with JIT giving near-native speed for hot code).
Integrated Development Environments (IDEs)
- An IDE brings writing, testing and debugging into one application:
- a code editor with syntax highlighting and auto-complete;
- one-key compile/run with errors shown inline;
- a debugger — set breakpoints 断点, step line by line, and inspect variables;
- plus version control, refactoring and unit-test integration.

A debugger pauses at a breakpoint so you can step through code and inspect each variable
Which feature is part of an IDE's debugger?
A debugger lets you set breakpoints, step through code line by line, and inspect variable values.
You've got it
- compiler = translate all at once → stand-alone executable, fast, platform-specific
- interpreter = translate line by line → needs the interpreter, slower, portable, errors found at the line
- Java compiles to bytecode run by a JVM → "write once, run anywhere" (+ JIT for speed)
- an IDE = editor + debugger (breakpoints) + tools in one app