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?
Like PHP, ASP, and JSP.
Someone should write a tool to find and erase all copies of this thing on a host. Wonder what such a thing could be called?
Ways not to have an impact on computing...
1) Define a new project with the same goal as multiple established projects.
2) Select a name that is already accepted for several other technologies.
3) Post it to Slashdot.
Lenny
I doubt there'll be much confusion, because I doubt too many people will bother with this. So when someone cays 'css', I think the safe assumption is that they're talking about 'cascading style sheets'.
As for C-like embedded scripting, ECMAScript is darn close (some java-like things such as some OO support, and every object has toString()), and Mozilla has embeddable interpretors of their Javascript implementation for both C and Java. I prefer ECMA/JavaScript 'cause of its OO. Its not secure encapsulation (e.g., "information-hiding"), but it at least gives me encapsualtion.
Mind you, I'm still in the reading-stages of learning [PJ]ython, 'cause I haven't had the time to really write something yet.
--
You know, you gotta get up real early if you want to get outta bed... (Groucho Marx)
"But remember, most lynch mobs aren't this nice." (H.Simpson)
-- Joe
Personally, I love C, and I think any language that doesn't give you pointers and low-level control with the accompanying ability to shoot yourself in the foot if you don't pay attention is an underpowered piece of crap. That is, however, just my personal opinion based on my own history and needs, and I don't expect everyone else to adopt it. I certainly don't go running around every time a new language comes out asking, "Why do we need a new language? We've already got C!"
Conformity is a wretched mental habit. It may have its uses in a business environment, but I'd think the Slashdot crowd, if no one else, would be clued into the fact that some people program for pleasure, too. You'd also think that programmers would have a better understanding of the pleasure that comes from successfully doing something difficult.
--
Proud member of the Weirdo-American community.
CSS bashers should have taken the time to click on the link to IBK. This software is not done on a lark, it appears to be an integral part of Peter Koch's business. Thus it is insulting to insist that the developer should have spent his energies on a more worthwhile project--his energies are being spent directly on his business. Looking at the technical aspects, his porting to OS/2, Windows, and Linux appears to tie in with the other product advertised on the IBK webpage, the Business Process System. Thus people who bash the developer for releasing a "new language" are totally missing the point--this developer has chosen to make available to the entire community his knowledge under the GPL. Hopefully this will reflect back to him in increased publicity and business contacts. The release of CSS is an increase to the community. Had the developer been discouraged from releasing, he would have had no incentive to have contributed to any other project.
#warning this program considered harmful
#ifndef foo
#define foo 0
int main (void) { return 0; }
#endif
#if (foo == 0)
#undef foo
#define foo 1
#include "foo.c"
#elif (foo == 1)
#undef foo
#define foo 2
#include "foo.c"
#elif (foo == 2)
#undef foo
#define foo 3
#include "foo.c"
#endif
--
Life's a bitch but somebody's gotta do it.
It's possible to do iteration with the C preprocessor. One example of it is http://www.ioccc.org/years-spoiler.html#1995_vansc hnitz
It is basically a file that #includes itself. Don't know if it's Turing complete though.
I prefer to write applications in Perl or Python, myself. Once the app is at a usable state, I run it through a profiler to see where the bottlenecks are. If the bottlenecks can't be opened up by tweaking the code and algorithm, then I code the bottlenecks in C or C++ and call them from Perl/Python.
Code spends 90% of its time in the same 10% of code. So this technique actually winds up working pretty well.
Many compilers do honor the register keyword. They don't automatically store the variable in a register, but the variable does get marked as needing a high degree of optimization.
The only thing I don't particularly care for about GUILE is that it's a bit LISPish... still.
You cannot apply a technological solution to a sociological problem. (Edwards' Law)
Heh. I thought you meant Top-Level Aggregation identifiers. There are only 2^13 of those. 8-)
------
Would you prefer to use Perl as a general-purpose language?
------
Learning curve.
------
Huh??? The pre-processor has no concept of iteration. I.e., you can't loop. Please provide some proof, or cite some reference, which shows that the C++ preprocessor (just C++? is the C preprocessor substantially deficient relative to C++?) is equivalent to a Turing machine.
Yes, but in a well-designed language, "a=b" and "a==b" wouldn't both be completely legal and yet have completely different meanings.
That version came from Bartlett's, as posted on Bartleby.
Specific quote ref is here.
General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
I Know it's Ben Franklin. The fscking 120 character limit hit me, dude.
General Relativity: Space-time tells matter where to go; Matter tells space-time what shape to be.
"I took a quick walk around the manual and checked out some of the examples, but it seems to me that C (or C-like languages) just aren't all that suitable for scripts. "
Gee, it's a good thing PHP doesn't look at all like C, or have stdlib like fuctions, eh?
--
--
Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
Same reason Javascript and Java have similar names: to steal existing Mindshare.
I love acronym abuse and polution! I would have thought intelligent people could avoid such unexcusably stupid decisions.
Fsck cluebie moderators. I'll say what I want, offtopic or not. And fsck having to qualify every bloody statement just
Your assignment for next week is to try to convince your boss to rewrite the entire project in Intercal.
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
How is this different from EiC? Is it supposed to be better in some way? :)
Well, the CSS site can handle the slashdot effect. The EIC site crumpled before this story had 50 comments.
Not to mention the MPAA's favorite CSS... It's kind of like George Foreman naming all of his kids George. It works for him, but it confused the hell out of everyone else.
Trolls make great pets. Adopt one today!
You CAN use (more or less) exact C syntax in your perl scripts (all but the declaring, and libs part)... If you know C, you can move to Perl in the matter of 1-2 hours.
"`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
Let's move to unicode.
"`Ford, you're turning into a penguin. Stop it.'" -THHGTTG
"Rub her feet." -- L.L.
The key difference is that Gnus will display the code for the script and ask the user: "do you want to execute this script?". You don't see any Gnus mail virii, do you?
--
TO BUY A NEW CAR WOULD MAKE YOU SEXUALLY ATTRACTIVE.
True, in Perl you don't have to declare variables. But good Perl programming is done with "use strict". I'm not an expert Perl programmer, so correct me if I'm wrong, but "use strict" requires programmers to be a little more careful to prevent errors. Variables must be declared in scope (global or local with my), along with other restrictions. Granted, you don't have to declare a datatype (other than indicate it's a scalar, array, or hash).
The things that seem to make Perl a great scripting language is that the syntax is moderately human readable (though it does have many symbols that can be confusing to newcomers). Also, Perl has great modules for CGI and text parsing, so that programmers don't have to reinvent the wheel. This makes many common CGI tasks a snap in Perl, while it may be more difficult in C (or a C scripting language).
"The universe seems neither benign nor hostile, merely indifferent." --Carl Sagan
The CSS scripting language is a intergral part of the PDP++ Neural Network software. I currently use PDP++ for research any find that CSS is a very convenient way to setup and run simulations. This is opposed to other large ANN packages such as the Stuttgart Neural Network Simulator (SNNS) which uses its own scripting language that is a mix (or rather mess) of awk, Pascal, Modula2, and C. So I don't have to learn a new language to use my software. Also, PDP++ is a completely object oriented and you can manipulate the objects in the system very effectively with CSS. However, I wouldn't (and don't) use CSS for everyday scripting tasks. If you want to embed a fairly robust scripting language with familiar syntax into your systems then CSS is the ticket, otherwise stick with Ruby or Perl.
-- DieZeugen
- remove the primate to mail
Aside from the issues surrounding yet ANOTHER computer related technology named CSS (cascading style sheets and content scrambling system (DVDs)) what exactly is the advantage to a c-like scripting language? It would seem to me (and to anyone who had done a substantial amount of scripting and C programming) that the entire philosophy and modus operandi of C and scripting languages are completely and utterly different. Moreover, what precisely is wrong with the (myriad) scripting languages we have now? Are there those who cannot find something among bourne shell, awk, sed, perl, python, and others that they can understand and use? Perl 5 is about as easy a language to learn as exists, and Python is about the same. I don't see a valid niche where this new beast might make a happy living. It's simply redundant and unnecessary.
I've determined that "C-like" really means just the following:
1. Uses curly braces to delimit logical code blocks
2. Uses lowercase statements for control flow (if, while, for, switch)
3. The 'for' statement is not a proper looping or interation statement, but is just a "while++"
4. The 'switch' statement is horribly limited to compile time numeric constants and requires you to remember to 'break' after each case, which is braindead.
5. The language relies on libraries of functions to do anything useful (printf, scanf, getchar, fopen, etc, etc)
6. Ends logical lines with semicolons.
And that's about it. When you see "C-like", they tend to be talking more about form than function, to be honest. And they certainly NEVER mean any of C's ugly (but of course powerful) sides, like pointer arithmetic, massively complicated typed variable declarations on one line, a preprocessor that can easily obfuscate meaning from simply examining the code with human eyes, etc, etc.
Quite frankly, C got so far as it did because it was VERY fast, and very powerful if you knew how to weild it... and these things were very important when you had little memory and slow processors to work with. To be honest, the design goals of C make almost no sense any more. And C++ (a language I've worked heavily in for 8 years) is an abomination these days. So complicated it literally takes YEARS to become truely proficient, and designing and implementing huge systems in it is pure torture. Languages like Java and the like are here to take advantage of the ever increasing cheapness and availability of CPU and memory (and disk). They simplify life dramatically, speed development, get rid of complicated maintenance of separate header and code files, compile lightening fast, report errors better, have fewer ambiguities and problems, and do the job "fast enough". Ditto for all the scripting languages around.
So frankly, it's getting to the point where being EXACTLY like "C" isn't a selling point on ANY level. Being "C-like" sorta helps a transition from a 'habit' sort of point of view, but really isn't that necessary any more.
- Spryguy
- Spryguy
There are three kinds of people in this world: those that can count and those that can't
It seems to me that the primary purpose of making a new general purpose language (scripting or compiled) should be to improve on what has come before.
Therefore a new language may differ significantly from past languages.
Does CSS offer any significant new advancements? If not, then why bother? We have plenty of scripting languages. Some bad, and some excellent.
--
"Linux is a cancer" -- Steve Ballmer, CEO Microsoft.
I'll see your senator, and I'll raise you two judges.
I agree.
Today, there is no wisdom to use Pascal as the only teaching language -- and I wouldn't even make Pascal a major focus.
One could argue, Pascal is still good in teaching environments where you want to compile to native code. Although there are other, but less popular choices, such as Modula-2.
By the time students reach the stage where they write performance critical code (i.e. calculate the mandelbrot set), they can probably use C/C++ or something mainstream.
--
"Linux is a cancer" -- Steve Ballmer, CEO Microsoft.
I'll see your senator, and I'll raise you two judges.
As convenient as it must be for die hard C programmers to write shell scripts in a C like language, honestly it would seem to me that they could pick up perl in a day and any shell scripting language in a couple of hours. In fact I would be shocked if they haven't already. And as much as I appreciate the freedom of innovation that people think they have creating new programming languages, just because they found another way to spell FOR doesn't mean they have the right to give birth to language. The people who are coming up with these web languages and scripting languages that pop up on freshmeat probably dream of the day when their language has their own O'Reilly animal/vegatible/other book. But do they really make the computing world a better place? Sure some languages with good ideas can start from no where and build momentum, like PHP for example. But it was innovative for its time, with its preprocessor inside of apache. And then it kept on innovating. Rebol is another example, probably the easiest language to get accustomed to, ever. You can change the language to your own syntax. That's some kind of an advance. That's what really needs to be the test for a new language. If you're not doing something new then what's the point? Personally I'm waiting for ASM-shell, why use perl to do assembler's work. Perhaps I'll try to write it myself. Then maybe someday I can get the chupacabra on my language's O'Reilly Book.
I hesitate to make this comment on Slashdot, but since this crayon character brought it up. . .
Pascal predates C by decades and its maturity is obvious to anyone who uses in for any length of time. As we all know, the orignal Mac up to System7 was done in Apple's ObjectPascal and there are still various development tools that rely on Pascal based scripting including Borland and several other Windows based development environments.
I'm not saying Pascal is better than C all around, but when it comes to scripting a user interface that simply calls upon functions written in a lower level language, I can't see the point of using anything else other than simple ignorance of the alternatives.
In educational multimedia, Pascal is king. This is an ugly market to a lot of slashdotters as it is a market where a lot of content experts rather than nerd-core geek "programmers" publish software with emphasis on ease of use. But if Linux is to really take market share from MS in the education market, there will have to be better Pascal-based development tools for making quick and easy user interfaces.
So, yeah, this idea sounds like a misguided student project which further underscores my point about getting better multimedia scripting environments for Linux into education.
For scripted control of setup and execution of Windows programs, including tasks in DOS windows, C Styled Scripting seems excellent.
Auto-It does this, and it is free, but it is not open source: http://www.hiddensoft.com/AutoIt/
Wilson WindowWare's WinBatch does this, and it is comprehensive, but it is not-free shareware, not open source, and I have had problems with poor documentation and poor technical support: http://www.windowware.com/
Question: People who write open source software often pick poor names for their work. Why is that?
Bush's education improvements were
Here is another way then to annoy the MPAA-- create a Deconstructor for CSS and call it DeCSS... Then when they complain, simply leave it at "I fail to see how your complaint has anything to do with the software at hand..."
LedgerSMB: Open source Accounting/ERP
Maybe we could stay with the 'C' language concept of adding plusses to change the name. This would be:
CSS++
Has a nice ring to it.
No sig for you.
- Pike (http://pike.roxen.com/)
- EIC (http://www.kd-dev.com/~eic/)
Hey, if C were appropriate for scripting, people would use it that way. Why won't these folks just let systems languages be systems languages, and scripting languages by scripting languages?Erlang.org: wow
Of course, in the end the choice of license is completely up to the author of the software... so be it.
This is certainly true, but having to do such thing all the time would be a drag... if I'm writing a PERL script that is going to be around for a while and maintained by others, I usually go with "use strict". If I'm just writing a quick one-off to do some specific data munging (or whatever), I can be as sloppy as I want. I suspect this CSS won't be as forgiving.
Anyways, maybe "not having to declare variables" was a bad example. Perhaps a better example would be more natural reg. exp. usage in Perl and Python, whereas this CSS seems to make use of a clumsy library, and other areas where Perl and Python have things "built in" that this CSS doesn't.
Ryan T. Sammartino
Ryan T. Sammartino
"Ancora imparo"
Ryan T. Sammartino
Ryan T. Sammartino
"Ancora imparo"
Errrm, "is" not the same as "==" in Python in all cases. "==" will check for equality, "is" checks to see if they are the same thing. When you're talking about objects, there is a difference.
I can't wait for my tee shirt featuring DeCSS in CSS!!
Wow, it looks like another scripting language is coming out every couple of months, I'm amazed! I wonder just how long it will be before they run out of compiled languages to mimic and they start making hybrid scripting languages. I can see the articles headlines now: "Visual Pyavel Basic++ combines the flexibility of Perl, the power of Python, the simplicity of Java, the comment syntax of Visual Basic, and a few operator overloading doohickeys from c++ (just for good measure) to make the world's ultimate scripting language! Get your copy today (Warning, a source code download is only available through CPAN#...)"
"Your superior intellect is no match for our puny weapons!"
You've brought up a valid point, but I believe you are hedging a little too closely on the differences between scripting and engineering. Both require different skill sets (though many an engineer knows scripting and vice versa), so you can hardly compare the [dis]advantages of either a scripting language or a truly compiled language (like C/C++). For example, how would you hope to write a device drive in Perl? Or why would you bother to write a basic parsing utility in C? Truth be told, C and C++ are the finest languages for programming ever implemented (notice I didn't say conceived).
:D
With languages as complex and daunting as these, it's up to the coder to get a handle of things. They don't pay us upwards of 6 figures for nothing. I find it interesting, by the way, that you mention C/C++'s intolerance for error. In C there isnt' much you can do aside from check for NULL pointers, etc in hopes of catching situations before they go awry. I'll give you that. In C++, however, we're given a rather robust exception handling mechanism. The only chore involved is learning how to properly use it (and in my time I've noticed few engineers truly do.) Additionally, in C++, your annoyance with pointers are solved by references.
I can tell, however, that you haven't spent much time in assembly. You'd probably bust a vein in your forehead over ASM's intolerance for errors.
Honestly though, you'd be hard-pressed to find any language better suited for a good 99% of all software development problems (and I'm not talking about pretty GUI driven database apps).
-[McP]KAAOS
It goes from God, to Jerry, to me.
Having lived through the little-language-dark-age (call it mid-eighties to early nineties), when it sometimes seemed like C and BASIC would drive out everyone but Chuck Moore, Ralph Griswold, and few Lisp hackers holed up on a farm in Montana, I am glad (no, strike that, I'm ecstatic) to see all the effort going into new (and sometimes not so new) languages. Carl, Larry, Guido, Peiter, and the thousands of others whose names don't spring to mind at this instant have my heartfelt gratitude. Personally, I'd much rather live in a chaotic world of plenty where, no matter how I want to spell "FOR", there's a language for me.
-- MarkusQ
csh considered harmful? Is this a reincarnation of the C-shell, but now we can run it everywhere? Good Ole' Bill Joy will be happy.
OK, I'll admit I didn't read the article, and I bet it has nothing to do with the infameous csh, but I'd thought I'd mention it anyways.
-- Another senseless waste of fine bytes.
There are already so many scripting languages available that a new one needs to offer some compelling feature. I'm running down the list of "CSS" features..
C syntax: Not really a feature. If you are a C programmer I suppose having something familiar is a bonus however.
Sophisticated error handling by exceptions - Perl, Python, and Ruby already have this.
High performance database libraries - Perl already has the very sophisticated DBI database interface. Python is at version 2.0 of its database API specification. A DBI interface is currently in development for Ruby.
Automate regular tasks or build application benchmarks with the outstanding windows control library: Perl, Python, and Ruby already have good windows integration.
Develop libraries to meet your special requirements using your favorite C/C++ compiler: Perl, Python, and Ruby can all be extended via C and/or C++
Develop libraries to meet your special requirements using your favorite C/C++ compiler: Ruby is embeddable in C applications. Python is embeddable in C and Java applications. Perl is weak in this area, but I believe Perl 6.0 is supposed to be easily embeddable.
Write CGI programs for your web server: You can write CGI in numerous scripting languages already. In addition, mod_perl allows you to directly access Apache's module API to write extensions to Apache itself. Then of course there is PHP although I do not consider PHP a general purpose language. Pike / Roxen is a viable contendor in this area as well.
A major feature that I see missing in "CSS" is OOP. Python and Ruby, two of the newer generation scripting languages, have very powerful OO features. Ruby is object pure... everything in the language is an object that is extendable down to basic types like strings and integers (similiar to smalltalk).
From my perspective using "CSS" instead of one of the next generation scripting languages (Python and Ruby) is a giant step backwards. In addition, the old mainstay Perl is a very mature language with an unparalleled library of available modules for it. What is the incentive for using "CSS" other than the novelty of having a C like syntax?
By the way, the name "CSS" was a HORRIBLE choice.
Take a look at Pike, it's been covered here in the past.
It has a c-like syntax, it has the preprocessor, and it has classes (full OOP), functional programming if you want, a nice runtime library. It doesn't have pointers, but it has references (no arithmetics though), and high-level constructs for strings, sets and associations. It does manage memory quite fine (refcount + garbage collector) and you can make it as pedantic as you want, even not at all (just use the mixed type everywhere).
This said, you won't get rid of the C syntax anytime soon. It has an advantage over most other syntaxes one can come up with for an imperative language: it's concise. And if used with some discipline, it can be very readable which is one of the most important requirements for a programming language. By adhering to a c-like syntax, any other programming language can be instantly readable by a lot of people.
The purpose of making one language similar to another is to shorten the learning curve of the second language. That's why we have the C shell, and its also why Java looks so much like (bleah) C++.
Now, I have no use for another C-like scripting language, but who says this language has to fit *my* needs to justify its existence?
-jcr
The only title of honor that a tyrant can grant is "Enemy of the State."
The world does not need another scripting language. Enough is enough!
Embedding scripting language into programs... you mean like SWIG?
http://www.swig.org/
Fsck cluebie moderators. I'll say what I want, offtopic or not. And fsck having to qualify every bloody statement just
Choice of programming languages comes down to what fits your needs and what fits your skills.
I've been programming in C++ for 7 or 8 years, and find it to be fantastic for expressing what I want to produce. I find it much easier to write code that's easy to debug and maintain than any other language I've ever dealt with.
Now, granted, a lot of that is due to a very detailed process that we go through before even writing the code, but well designed C++ systems can be quite easy to maintain.
I've written several large systems in C++ and found it to be very easy to maintain and debug. My last major system had over 150 classes in a very well designed architecture. Although more than 30 people were involved at various times during it's implementation (over a 5 year period), in the end, there were two of us maintianing it and adding new features. And when I say new features, I'm talking about major additional functionality.
Now, could Java do what this system did? Yes, but probably not at the same speed. This was a very mathmatically intensive system. It modeled cellular telephone networks (the antennas at base stations as well as the mobile phones).
I still like C++. I like it a lot. It has made my life much easier. Until I find a language that's going to make my life easier, I have no intention of changing.
That said, is C++ the best language for every task? Of course not, and I certainly don't use it for web scripts. Everyone has their own reasons for choosing a language, though, and as I'm very C++ oriented, a C style scripting language would probably be very easy for me to adapt to. Perl sure as hell wasn't easy for me to adapt to.
Am I the only one who's going to look at people funny now when they say CSS. Do they mean Cascading Style Sheets, or this? Argh, the headaches! CSL would've been better: C Scripting Language. Hey, that's practicality!
Trolls make great pets. Adopt one today!
you'll see that Inline::CPR lets you do this.
tada! interpreted C.
Paul
from the site;
Small is a simple, typeless, 32-bit extension language with a C-like syntax. A Small "source" program is compiled to a binary file for optimal execution speed. The Small compiler outputs P-code (or bytecode) that subsequently runs on an abstract machine. Execution speed, stability, simplicity and a small footprint were essential design criteria for both the language and the abstract machine.
Write your Own Operating System [FAQ]!
no sig for you
I can't believe I had to read this far down to see a mention of EiC. First, and this is important...
...one of the best things about EiC is that it is NOT merely "C-like". EiC tries to follow the ANSI/ISO standards as closely as possible and does a very good job of meeting C90. Last I heard, C99 support was in the works.
Whenever I hear "C-like" I always get suspicious, and it almost always turns out that the syntax is not true C. Based on what other people are saying, it looks like the article is mentioning yet another one of those, and if that's true I have no use for it.
As for the people who are wondering why people want scripting in standard C, here are my reasons:
1. Code re-use. With a babel of scripting languages, you are duplicating functionality at times. When you do your scripting in C, you can take ideas that started out as scripts and easily incorporate them into powerful programs at a later date. Likewise, you don't have to translate the large body of C source code floating about into some other language--you can just use it.
2. Rapid Application Development, which ties in closely with point 1.
Long live C! Although I haven't actually tried it, I plan to use a C to Java translater, make, and javac to build Java applets without actually writing Java.
The only new language I want to see is a metalanguage analogous to PBM so that I can maintain all my code in C, run CtoPBMlang and PBMlangtoFOO with make to build for whatever scripting environment is required.
It's funny to think that programmers are trying to write translaters for human languages. We don't even have reliable automatic translators for the far simpler languages that we have invented for programming!
For all intensive purposes, "whom" is no longer a word. That begs the question, "who cares"?
Ok, first of all why would you want pointers in a scripting language? It's a SCRIPTING language we're talking about here!!! Scripting languages are supposed to be an easy way to expose the functionality of a program, not a tool to create security holes and logic errors. Introducing pointers into something like this will create more bugs (both intended and accidental) and be a major pain in the butt for the script programmers to deal with.
Also, since when is goto a major feature of C? One of its very few legitimate uses is to break out of a deeply nested loop. Ok, so other than this one use (which optimizes some code only some of the time), what is it good for?
Finally, #defines are a nice feature of c, but again, this is a SCRIPTING language. If you just need a constant, declare one const. If you need a function that returns the bigger of two numbers, write the function! I fail to see what features they've left out that are really needed in a scripting language. p.s. I do agree with you that CSS is a pretty bad choice of acronyms.
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?