5

Functional/non-functional and interpreted/compiled are two different categorizations, yet it seems that there are a lot of overlaps in the programming languages that fall under those categories. Is this a coincidence?

1 Answers1

19

There is no such thing as an "interpreted language". A language is a set of abstract mathematical rules. A language isn't interpreted or compiled, it just is. Interpretation and compilation are traits of, well, the interpreter or compiler (duh!), not the language.

A language is an abstract entity, an interpreter or compiler is a concrete implementation of that abstraction. The two live on completely different levels of abstraction. The term "interpreted language" is not just wrong, it doesn't even make sense. If English were a typed language, "interpreted language" would be a type error!

You can't ask whether a language is an interpreted language, the answer isn't "yes" or "no", because the question itself is non-sensical. It's like asking whether orange is a prime number.

Every language can be implemented with an interpreter, and every language can be implemented with a compiler. You can automatically derive a compiler from an interpreter and an interpreter from a compiler.

The vast majority of languages have both compiled and interpreted implementations. The vast majority of modern high-performance language implementations are mixed-mode implementations which combine interpretation and compilation.

Now, let's look at some popular functional languages and some of their popular implementations:

  • Haskell
    • GHC, the Glorious Glasgow Haskell Compiler: obviously a compiler
    • UHC, the Utrecht Haskell Compiler: again, a compiler
    • JHC, also a compiler
    • HUGS (no longer maintained): an interpreter
  • Standard ML
    • SML/NJ (Standard ML of New Jersey): a compiler
    • MLton: a compiler
    • ML Kit: a compiler
    • Moscow ML: a compiler
    • TILT: a compiler
    • SML.NET: a compiler
    • Alice: an interpreter
  • OCaml: there is only one implementation of OCaml, a compiler
  • F♯: there is only one implementation of F♯ (Microsoft Visual F♯), a compiler
  • Scala: there is only one implementation of Scala, a compiler
  • Clojure
    • Clojure: a compiler for the Java platform
    • ClojureCLR: a compiler for the CLI platform
    • ClojureScript: a compiler for the ECMAScript platform
  • Scheme
    • Racket: compiles Scheme to bytecode, then either interprets or compiles that byte code
    • Stalin: a compiler
    • Gambit: a compiler
    • CHICKEN: a compiler
    • Ikarus: a compiler
    • Larceny: a compiler
    • IronScheme: a compiler
    • Bigloo: a compiler
    • Kawa: an interpreter
    • Gauche: an interpreter
Jörg W Mittag
  • 104,619