News for hackers. Stuff that matters.

Ask HN: Compiled and Interepted language?

Is it possible for a language to be both compiled as well as interpreted.

* During development we can use interpreter to rapid application development * In production environment same code base gets compiled to machine code or bytecode for performance reasons

Is it possible? Or is it a stupid idea?

( 6 comments | on HN )
Re:Ask HN: Compiled and Interepted language? by pmarin on Thursday November 19, 2009 @06:11AM (#950059)
Actually the different between compiled and interpreted language is very weak. For example, when you compile a C program the result is a code in a machine language and the machine language is "interpreted" by the Control Unit of the processor but if you are running the machine code in a emulator it is actually interpreted by the emulation layer.
Re:Ask HN: Compiled and Interepted language? by ErrantX on Thursday November 19, 2009 @05:33AM (#950028)
Although it's not quite what you mean there is Cython - it's a Python extension to Distutils that lets you convert Python code to C & compile it.

We actually use this in the way you describe - using the interpreter as our test bed but compile it via Cython (for code protection and speed reasons) on deployment.

Re:Ask HN: Compiled and Interepted language? by towndrunk on Thursday November 19, 2009 @07:23AM (#950115)
I'm not so sure skipping compilation is going to give you rapid development.
Re:Ask HN: Compiled and Interepted language? by pkc on Thursday November 19, 2009 @09:38AM (#950286)
During development certainly I can iterate more quickly with interpreted languages than with compiled ones. It improves development time considerably.
Re:Ask HN: Compiled and Interepted language? by jpr on Thursday November 19, 2009 @05:41AM (#950033)
I think Common Lisp standard requires implementations to have both interpreter and compiler, but allows some freedom how to do it. Some implementations compile to byte code (I think CLISP does this), and some compile to native code on the fly (SBCL). Haskell and OCaml also have both interpreters and compilers available. So yes, it is quite possible.
Re:Ask HN: Compiled and Interepted language? by njn on Thursday November 19, 2009 @05:18AM (#950020)
Yes it is possible. There are countless examples. ghc is one.