Page 1 of 1
Any compiler that is server based?
Posted: Wed Oct 17, 2007 10:28 pm
by earlz
Ok, I love to program while on the fly(and hence on unfamiliar computers) and so I'd like if it was possible to compile C or C++ code through a PHP script...
I have yet to see a thing like it...so it might be a future program I attempt to make...
Posted: Wed Oct 17, 2007 11:47 pm
by Solar
Should be dead easy to whip up a script that takes a list of files, and passes them to make / GCC on the server, returning the binary.
I don't know of a ready-made solution however, and don't think there are many around simply because the requirement is a bit... exotic.
Posted: Wed Oct 17, 2007 11:57 pm
by JackScott
Have you looked in to SSH? If you don't have any restrictions on port access, it might be really good. There are quite a few free shell servers around, and quite a few good ones (that are fairly cheap). There is also the option of dialing into your home computer, if you know it is on.
Posted: Thu Oct 18, 2007 1:26 am
by AndrewAPrice
http://www.google.com/search?q=online+compiler
I'm sure a few will describe how they're doing it.
Posted: Thu Oct 18, 2007 6:44 pm
by pcmattman
I tried one using exec, system, passthru, none worked for me... Maybe it's because I was trying to do it via Cygwin.
If you can get it to work, I'd love to see your code
Posted: Thu Oct 18, 2007 9:39 pm
by earlz
meh...it's possible, but it'd mean writing a parser and assembler in PHP(I'd want it to work on any server I put it on, btw)
also, I can't make compilers or parsers or such...so...
Posted: Fri Oct 19, 2007 12:19 am
by bas
you can execute gcc from PHP with the exec function:
string exec ( string $command [, array &$output [, int &$return_var]] )
and you can get the errors in the output array.
Posted: Sat Oct 20, 2007 9:43 am
by SpooK
hckr83 wrote:meh...it's possible, but it'd mean writing a parser and assembler in PHP(I'd want it to work on any server I put it on, btw)
also, I can't make compilers or parsers or such...so...
Considering that I have done so, I would say yes. PHP is actually optimal for situations like this because it is stronger with dynamic memory and strings. Sorting arrays and building syntax trees is less tedious. The speed factor is negligible as Zend is pretty good with developing their product.
Also, you can keep up hopes that the Roadsend PHP compiler, which is open-source now, will continue to improve to the point of real usability.
Posted: Mon Oct 22, 2007 5:48 am
by binutils
Posted: Tue Oct 23, 2007 3:43 am
by B.E
hckr83 wrote:meh...it's possible, but it'd mean writing a parser and assembler in PHP(I'd want it to work on any server I put it on, btw)
also, I can't make compilers or parsers or such...so...
are you retarded, reading this thread I seen least 4 solutions to what you want.
If your looking for a ready made solution to this very miner problem, then you should learn how to do it _yourself_, rather than blindly copying code.
Sorry if I'm to harsh, but this kind of question really annoys me.