You are not logged in.
Pages: 1
Hello all,
thought for some time if this should go int "off-topic" or "other languages"
I'm wondering why there are no programming languages that can be both interpreted and compiled? Or have i missed some? Is there anything in one blocking the other?
regards
#348498 +(4737)- [X]
<MasterG> .....................................................................
..................................
<judas> where's pacman when you need him?
Offline
I'm wondering why there are no programming languages that can be both interpreted and compiled?
There is Java, I'm sure you heard of it. First it is compiled into bytecodes, then this is "interpreted" on JVM.
IMHO this in most cases wouldn't make muche sense, because this approach would usually just combine the bad sides of both types of languages.
Maybe a language that could be either interpreted or compiled (not both) would be more interesting, but I don't know if there is one.
Offline
pyrex compiles Python into compiled binaries...
And there's a tool for compiling Java to binary too, I think.
Dusty
Offline
mico: I think he meant "interpreted OR compiled" as in you can run it like a script, or compile it to binary form
There are no languages like that because, from a logical standpoint, it just doesn't fit. Kinda like "why aren't there any vegetables that are both a potato and an onion?". The thing is, interpreted languages are still compiled, it's just done on the fly - just in time compiling, as some call it. Python is the closest to what I suspect you're talking about... `python my_script.py` will run a python script, but it also outputs a "my_script.pyc" file, which is a compiled (think java bytecode) form of the source. Timestamps are compared on each run, and if at all possible it runs the pre-compiled version.
Does that help any?
Offline
I think there are some tools that can compile Java to native machine code. E.g. http://gcc.gnu.org/java/, http://www.excelsior-usa.com/jet.html
Offline
the point with scripting languages is that you don't do any memory management and you don't have to define the type and size of the variables, also eval() and such like statements are not possible to compile to native binaries,
arch + gentoo + initng + python = enlisy
Offline
AAhhhh, teh beauty of Lisp...
http://lush.sourceforge.net/index.html -- LUSH, based on Lisp
http://www.cons.org/cmucl/ -- Common Lisp
but maybe also
http://www.ocaml.org -- Ocaml, if you can get along with a ML based language; not a real interpreter but compiles on the fly, giving the impression "as if interpreted"
Offline
pyrex compiles Python into compiled binaries...
Do you mean:http://nz.cosc.canterbury.ac.nz/~greg/python/Pyrex?
This seems to first translate python into C and then compile...?
Why not a native python compiler?
#348498 +(4737)- [X]
<MasterG> .....................................................................
..................................
<judas> where's pacman when you need him?
Offline
mico: I think he meant "interpreted OR compiled" as in you can run it like a script, or compile it to binary form
There are no languages like that because, from a logical standpoint, it just doesn't fit. Kinda like "why aren't there any vegetables that are both a potato and an onion?". The thing is, interpreted languages are still compiled, it's just done on the fly - just in time compiling, as some call it. Python is the closest to what I suspect you're talking about... `python my_script.py` will run a python script, but it also outputs a "my_script.pyc" file, which is a compiled (think java bytecode) form of the source. Timestamps are compared on each run, and if at all possible it runs the pre-compiled version.
Does that help any?
Yes, thank you, interpreted Or compiled is exactly what i meant.
Logical standpoint... from my view, i'd say it's more like "why aren't there any potatoes that you can both cook and fry?" or even, "why aren't there any potatoes which can be cooked during mornings and eaten at dinner as well as potatoes which you cook right before?"
which there of course are, therefore I don't understand why there could not be such languages too.
And yes, I know some python. and AFAIK, .pyc files still need python to run.
#348498 +(4737)- [X]
<MasterG> .....................................................................
..................................
<judas> where's pacman when you need him?
Offline
the point with scripting languages is that you don't do any memory management and you don't have to define the type and size of the variables, also eval() and such like statements are not possible to compile to native binaries,
Well if the interpreters usually manages the memory management, why cannot that be compiled into the binary also, automatically?
Even though the variables doesn't have to be defined manually, they are defined, if so at run time, or rather at the pre-compilation stadium. (Now talking about python, it is sort of compiled right before it is run, isn't it?)
Now since those variables then can be defined at run time, could they not be defined in a compilation beforehand too?
I guess eval() means evaluate or similar, but I don't have enough programming knowledge to answer your statement. Could you kindly clearify?
#348498 +(4737)- [X]
<MasterG> .....................................................................
..................................
<judas> where's pacman when you need him?
Offline
AAhhhh, teh beauty of Lisp...
http://lush.sourceforge.net/index.html -- LUSH, based on Lisp
http://www.cons.org/cmucl/ -- Common Lisp
but maybe also
http://www.ocaml.org -- Ocaml, if you can get along with a ML based language; not a real interpreter but compiles on the fly, giving the impression "as if interpreted"
Oh...So you mean Lisp can be interpreted (more or less), as well as compiled? Sort of python and C in one?
#348498 +(4737)- [X]
<MasterG> .....................................................................
..................................
<judas> where's pacman when you need him?
Offline
Yes, and another one comes into my mind:
http://www-sop.inria.fr/mimosa/fp/Bigloo/ -- Bigloo, a version of Scheme
Compiled code and interpreted code can be mixed together. That is, interpreted code is allowed to call compiled code and vice versa.
Bigloo compiles to C before it compiles to machine code, but does a very good job.
Offline
IINM, PERL can be compiled into C code
from there it can be compiled by GCC into binaries of whatever sort you prefer
I think that I read that in Programming Perl, by the man himself, Larry Wall. But that information could be incorrect, it is not something I ever have to do. For one thing, everybody should have PERL installed. For another, I do not write sufficiently large programs to be worth compiling them. In addition, I feel that such an undetaking really is best when one knows enough about C to proofread. Just to make sure we won't be segfaulting or such things.
Those who would surrender a little freedom for the false sense of security deserve neither freedom nor security.
- Benjamin Franklin
Therefore
Give me Liberty, or give me death.
- Patrick Henry
falmarian-at-falmarian-dot-us
Offline
Pages: 1