Are there any low-level languages that can be used in place of scripts?

我与影子孤独终老i 提交于 2020-01-01 06:36:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!