[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c

The end of C-like script languages - C script with TCC

lovecreatesbeauty@gmail.c0m

5/20/2011 7:50:00 AM

On French genius' TCC page: TCC can also be used to make C scripts,
i.e. pieces of C source that you run as a Perl or Python script.
Compilation is so fast that your script will be as fast as if it was
an executable.

I'll try TCC and use C to replace PHP for web scripting, and Perl for
shell script. No need to bear with all the strange, unneeded and
different syntaxes in Php and Perl. What do you see?
24 Answers

Tom St Denis

5/20/2011 11:27:00 AM

0

On May 20, 3:50 am, lovecreatesbeauty <lovecreatesbea...@gmail.com>
wrote:
> On French genius' TCC page: TCC can also be used to make C scripts,
> i.e. pieces of C source that you run as a Perl or Python script.
> Compilation is so fast that your script will be as fast as if it was
> an executable.
>
> I'll try TCC and use C to replace PHP for web scripting, and Perl for
> shell script. No need to bear with all the strange, unneeded and
> different syntaxes in Php and Perl. What do you see?

Unless they added string handling ala perl it ain't replacing squat.

Tom

Ben Bacarisse

5/20/2011 11:36:00 AM

0

lovecreatesbeauty <lovecreatesbeauty@gmail.com> writes:

> On French genius' TCC page: TCC can also be used to make C scripts,
> i.e. pieces of C source that you run as a Perl or Python script.
> Compilation is so fast that your script will be as fast as if it was
> an executable.
>
> I'll try TCC and use C to replace PHP for web scripting, and Perl for
> shell script. No need to bear with all the strange, unneeded and
> different syntaxes in Php and Perl. What do you see?

I see much wailing and gnashing of teeth. Why replace a language
designed for the job with one designed for quite another?

--
Ben.

Malcolm McLean

5/20/2011 12:07:00 PM

0

On May 20, 2:36 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>
> I see much wailing and gnashing of teeth.  Why replace a language
> designed for the job with one designed for quite another?
>
Because everyone who did any serious programming in the past 20 years
can knock up a small script in C. With perl, I find myself scratching
about in the manual for quite simple operations. like sorting a list
of strings by suffix.



Ben Bacarisse

5/20/2011 12:22:00 PM

0

Malcolm McLean <malcolm.mclean5@btinternet.com> writes:

> On May 20, 2:36 pm, Ben Bacarisse <ben.use...@bsb.me.uk> wrote:
>>
>> I see much wailing and gnashing of teeth.  Why replace a language
>> designed for the job with one designed for quite another?
>>
> Because everyone who did any serious programming in the past 20 years
> can knock up a small script in C.

I can't refute that though I know at least two people who have done
serious programming very recently and who would not be able to write any
C. Did you mean "for the past 20 years" rather than "in the past 20
years"? Anyway, currently this is just another fact that's been stated
before which we are expected submit (or spend time researching
ourselves).

> With perl, I find myself scratching
> about in the manual for quite simple operations. like sorting a list
> of strings by suffix.

I don't see what I am expected to take from this. Do you mean that you
don't know Perl well enough to know how suitable it is for the job? Or
maybe you mean that, since you know C, and everything can eventually be
written in C, that there is no point in knowing any other language?

If all you mean is that you don't currently have the time or the
inclination to learn Perl, that's fine, but it is not much of an
argument in favour of C as scripting language.

--
Ben.

Rui Maciel

5/20/2011 1:18:00 PM

0

Malcolm McLean wrote:

> Because everyone who did any serious programming in the past 20 years
> can knock up a small script in C. With perl, I find myself scratching
> about in the manual for quite simple operations. like sorting a list
> of strings by suffix.

In the scripting world, perl isn't exactly the only choice. In fact, I'm
not aware of a single instance of perl being used as an embedded scripting
language. As Python and Lua are extensively used and even designed for
that purpose, they tend to be better comparissons.

Considering this, I don't believe that a programmer with over 20 years of
experience developing software will have any trouble hacking up simple
Python/Lua scripts.


Rui Maciel

Rui Maciel

5/20/2011 1:20:00 PM

0

lovecreatesbeauty wrote:

> On French genius' TCC page: TCC can also be used to make C scripts,
> i.e. pieces of C source that you run as a Perl or Python script.
> Compilation is so fast that your script will be as fast as if it was
> an executable.
>
> I'll try TCC and use C to replace PHP for web scripting, and Perl for
> shell script. No need to bear with all the strange, unneeded and
> different syntaxes in Php and Perl. What do you see?

Are you a developer for this TCC thing?


Rui Maciel

ram

5/20/2011 2:54:00 PM

0

Malcolm McLean <malcolm.mclean5@btinternet.com> writes:
>like sorting a list of strings by suffix.

I do not know Perl that well, but was able to construct a
solution using results of a web search engine in a few minutes:

#!/usr/bin/perl
#perl 5.8.3

use strict;
use warnings;

sub suffix( $ ){ substr $_[ 0 ], -3; }

print sort{ suffix( $a )cmp suffix( $b )}
qw( alpha.bat gamma.exe beta.bat );

I guess, it cannot become much shorter or more readable
when implemented in C.

Datesfat Chicks

5/20/2011 6:09:00 PM

0

On Fri, 20 May 2011 00:50:24 -0700 (PDT), lovecreatesbeauty
<lovecreatesbeauty@gmail.com> wrote:

>On French genius' TCC page: TCC can also be used to make C scripts,
>i.e. pieces of C source that you run as a Perl or Python script.
>Compilation is so fast that your script will be as fast as if it was
>an executable.
>
>I'll try TCC and use C to replace PHP for web scripting, and Perl for
>shell script. No need to bear with all the strange, unneeded and
>different syntaxes in Php and Perl. What do you see?

Won't work.

First, it can't be as fast as C if there is a compilation phase
whenever the script is invoked. That is an inherent contradiction.

Second, it ain't quite the right tool for the job; and C exists as a
possibility for web scripting, anyway.

PHP/Perl/Python have these advantages:

a)They are efficient for what they are. In some cases, the bytecoding
is an explicit option as a substitute for compilation (Python) and in
other cases it has to be done every time the script is invoked (PHP).

But these scripting languages are brutally fast. Much of the
advantage comes from the fact that the high-frequency iterations
(string searching, etc.) is "compiled in", as there are built-in
functions in the scripting language. So, the things that are done
dozens, hundreds, or perhaps thousands of times are done in the
scripting language, but the things that are done tens of thousands of
times or millions of times are done in compiled code. These languages
are fast.

Additionally, languages like PHP allow you to link in compiled
libraries if efficiency is a concern. So, imagine I'd like to erect a
web page that calculates prime factors or generates cryptographic
keys. I can add in compiled modules that do this efficiently.

b)Second, these languages protect the programmer from C-like errors.
When I make a boo-boo in PHP, I might get an error displayed as part
of the HTML content and/or an error in the logs. These are much
easier things to diagnose than a memory protection fault, for example.

c)Third, it is so convenient to make a one-line change in a PHP script
somewhere and not have to re-build anything. I can just change
dynamic web content directly with a text editor.

d)Fourth, C is ALREADY available as a CGI-BIN language. You can write
CGI-BIN handlers for Apache and so on.

I don't see the purported advantage.

DFC

lovecreatesbeauty@gmail.c0m

5/20/2011 6:53:00 PM

0

On May 20, 9:19 am, Rui Maciel <rui.mac...@gmail.com> wrote:
> lovecreatesbeauty wrote:
> > On French genius' TCC page: TCC can also be used to make C scripts,
> > i.e. pieces of C source that you run as a Perl or Python script.
> > Compilation is so fast that your script will be as fast as if it was
> > an executable.
>
> > I'll try TCC and use C to replace PHP for web scripting, and Perl for
> > shell script. No need to bear with all the strange, unneeded and
> > different syntaxes in Php and Perl. What do you see?
>
> Are you a developer for this TCC thing?

No. I just became days agao a reader of Mr Bellard's site: bellard.org

William Ahern

5/20/2011 8:41:00 PM

0

Rui Maciel <rui.maciel@gmail.com> wrote:
> Malcolm McLean wrote:

> > Because everyone who did any serious programming in the past 20 years
> > can knock up a small script in C. With perl, I find myself scratching
> > about in the manual for quite simple operations. like sorting a list
> > of strings by suffix.

> In the scripting world, perl isn't exactly the only choice. In fact, I'm
> not aware of a single instance of perl being used as an embedded scripting
> language. As Python and Lua are extensively used and even designed for
> that purpose, they tend to be better comparissons.

Python doesn't embed any better than Perl. Python's C API isn't any more
capable than Perl's, it's just much cleaner. Consider, for example, that
Python doesn't support multiple interpreter instances, but Perl does. When
_embedding_ this can be a useful feature. IMO neither embed very well, and
if Python is more popular for embedding its because it's become more trendy
over the years compared to Perl.

Lua, on the other hand, is significantly more suitable for embedding for
myriad reasons. It's also much easier to extend Lua than Perl or Python, but
Lua is a much simpler language with fewer, if any, large and sophisticated
modules available. So for extending, rather than embedding, Python or Perl
is often preferable. And of the two Python may be preferable because it's
API is less arcane.