DEV Community

Discussion on: Explain Interpreted Programming Languages Like I'm Five

Collapse
 
mortoray profile image
edA‑qa mort‑ora‑y

In the spirit on ELI5...

Imagine a new kid, Tommy, comes to kindergarten. He doesn't speak a language you know, but your friend Sam happens to speak his language. If you want to say something to Tommy, you tell Sam, who rewords it and says it to Tommy in his native language. Tommy says something back and Sam interprets it again and says it to you.

You have no idea how to talk to Tommy actually, nor do you know what he says. But your interperete Sam is making it seems as though you do. Your words, in your language, seem to be getting heard by Tommy. What Tommy says back is understood by you (via Sam).

Sam does this job for each sentence, back and forth. He's your interpreter.

Your uncle Rich is a master of robotics. He's keen on having everybody understand each other. He thinks translaters, while good, end up losing some meaning, and limiting what people can say to each other, as well as being slightly slower.

So Rich has a way of putting little nanobots (tiny robots) in your head. When you wish to tal to Tommy you find yourself magically talking directly to him, in his language, and understanding his language in turn. You think really hard while this is happening, but your own language is nowhere to be found in your head. You're truly thinking, speaking, and hearing in Tommy's language -- you can even access idioms (phrases and sentences) that you'd have no idea how to express in your own language.

We're going to call Uncle Rich a compiler. He's gone now, but you've been permanently converted to talk with Tommy, no need for Sam at all!


Sorry, that's about the best I can do in ELI5 form. It's a tricky topic as the lines between interpreted and compiled are not clear.

You can read my article Abstract Machines, Interpreters and Compilers or refer to minor details in how a language affects the resources it uses, as the answer includes relevant information to interpreting.