C Styled Script - C-like Scripting Language
Exomorph writes: " C Styled Scripting (CSS) has just been released for Linux! (Already available for Windows, and OS/2) You can use CSS like an interpreter (Like Perl) or as a scripting engine within your own applications. It follows the C syntax very closely and has now been released under the GNU General Public License." Is anyone using this?
Why do we need yet another C-like language? I use PHP now for virtually everything (using the CGI version so you can write standalone scripts) It's great for little one-off scripts or whatever. Another C-interpreter type project is EIC, which is actually extremely close to standard C. It works well for most programs you don't want to constantly recompile.
C interpreters have been around for a long time. Have a look at Scripting with C.
Why is this comment rated "funny". The guy is
proposing using GCC as a a just-in-time compiler.
I was thinking of doing just that for an embedded
app where you need users to script but you also
need real-time code. OK, so maybe not with GCC,
but the idea is valid and serious.
Seriously though, do we *really* need another scripting language? We've got perl, python, rebol, scheme, csh, bash, sh, ksh, [insert favorite scripting language here]...
Remember that C is a lot more than a language. A lot of people overlook one of the most important features of the language--namely, the preprocessor. In C++, the preprocessor by itself is a Turing environment; any computing task which you can think of, you can do in the preprocessor alone just by giving it some particularly weird templates to compile.
How does a scripting language plan on implementing the preprocessor? If it doesn't, then should it really have "C-like" in the name?
The other issue is... what's the point? I hate to tell people this, but C/C++ are two of the worst languages on the planet. I say this as a long-time C++ hacker and C++ enthusiast: the languages are awful. There are pointers all over the place, there's God-knows how many levels of indirection, there's detailed memory management... C/C++ are so powerful because they give you such fine-grained control over every aspect of the CPU. But they're cast-iron bitches to program in, because they're so intolerant of any error.
Scripting languages, on the other hand, are inefficient. They're slow. But they're also wonderful to program in as a result--their syntax isn't as rigorous, there's very little memory management to be had, there's no need to know the difference between the register and auto keywords, or the difference an inline amd a macro.
A C-like scripting language seems like the worst of both worlds. You've got the pedantic syntax and attention to detail of C, and the lackluster performance of a scripting language.
What's the point?
However, there are more uses for a scripting language than just quick one-off scripts. As mentioned in the article blurb, this language can be embedded within your own applications to provide scripting support.
Also, naming it CSS is pretty confusing, given that CSS already equals Cascade Style Sheets.
Anyways, how can I get my SourceForge project on the front page of /.? :)
Ryan T. Sammartino
Ryan T. Sammartino
"Ancora imparo"
If you're a pretender, you might write a wimpy interpreted version of C.
If you're a real software architect, however, you'd #include the gcc source tree right into your app, compile the user's code on the fly, pipe the output into a memory-mapped file, and long jump straight into the results. Damn the torpedoes.
Make no compromises on the performance of your users' macros. If they're worthy of your program, they need the speed. If they're not worthy, they'll write some lame pointer bug and dump core; I say good riddance to those lusers.
Several of the complaints posted here about how awful C is as a scripting language indicate that people aren't actually reading the language description for CSS. Among other things:
:-).
* Variables must be declared but are untyped.
Like Tcl, everything appears to be a string.
* There are no pointers (though there are
call-by-ref parameters).
* There is no memory management, though there
is a way to dynamically change the size and
dimensions of an array object.
* There are some extensions, such as
exception handling and string concatenation
* There is no "goto" construct.
* There is a limited preprocessor facility
(#ifdef equivalents, but no macros).
Overall, it looks like a rather nice embedded scripting language, though it's not nearly as cool as embedded Scheme
Here's something I would like to see: an interpreter for C code that follows exactly what gcc would do. Then you could make a nice GUI environment for programming, where everything happens as you type it with no compile cycle. Then at the end you compile everything to get speed.
Will my computer explode if I write DeCSS in CSS?
General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
Or am I just blind to some bigger picture?