MyLeoNes™

How programming languages become executable — Technology, 14–17 years

People write instructions in languages designed for humans, but processors need simpler instructions. Compilers and interpreters connect those two worlds.

Idea

A programming language lets a person describe a procedure using words, symbols and rules that are easier than machine code. A compiler translates a whole program before it runs; an interpreter reads and carries out instructions as the program runs. Both preserve the intended steps.

Why

The problem was that early programmers had to write long sequences of tiny processor instructions, which was slow and easy to misread. Languages such as Fortran and later Python let people express ideas closer to mathematics or everyday logic. Translation makes programs easier to create, share and change.

Worked example

Suppose a program says: total = 3 + 4, then print total. First, the language recognises names, numbers and the plus sign. Next, a compiler turns the addition and output into processor instructions. When the program runs, it calculates 7 and sends 7 to the screen.

Trap

A reasonable mistake is to treat the computer as if it understands the meaning of a sentence. It does not guess what you intended: every spelling, punctuation mark and data type must fit the language rules. A human can understand a typo; a translator may stop or produce a different action.

Use

The same idea appears in websites, games, scientific models and phone apps. Developers choose a language for its strengths: JavaScript can make a web page react, Python can analyse data, and C can control devices closely. The processor still needs translation underneath.

Keep exploring

Other languages

Loading MyLeoNes™…