问题
I am a "high-level" scripting guy. All my code is Class-based PHP or JavaScript. However, I want to know if there is any form of useful interpreter projects for "low-level" compiled languages like C or C++ (strange sounding huh?).
This all came about when I stumbled upon http://g-wan.com/ and was fascinated by the fact that you could setup C code to run as server scripts. However, that project is all but useless because it is run by one guy and is closed source.
So, is there anything out there for "low-level" languages that would enable them to be easier to run by compiling them at runtime. OR is this just a bad accident waiting to happen which explains why that was the only project I could find about this?
Being able to dump PHP/Ruby/Python for C scripts would really speed up our sites.
回答1:
I recently stumbled upon something called BinaryPHP in which you code normally in php and then convert the script into C++ to be compiled on your favorite tool. That should be a nice learning curve for someone already in touch with php.
回答2:
Im not sure I understand what you want to achieve, but tcc (tiny c compiler) allows you to run C programs as scripts.
http://linux.die.net/man/1/tcc
TCC can be invoked from scripts, just as shell scripts. You just need to add "#!/usr/local/bin/tcc -run" at the start of your C source:
#!/usr/local/bin/tcc -run
#include <stdio.h>
int main()
{
printf("Hello World\n");
return 0;
}
回答3:
There are products like Beanshell for Java. They aren't intended to replace scripting languages but instead to allow an easy unit testing and debug capability to an existing language. In my opinion you should use a language for what it was designed for.
来源:https://stackoverflow.com/questions/2277865/are-there-any-low-level-languages-that-can-be-used-in-place-of-scripts