XL Compiler Bootstrapped 80
descubes inputs: "An XL compiler bootstrapped two days ago (that means it compiled itself). Take a look at the project homepage to discover this language, designed around concept programming ideas, which is a sort of cross between C++, Lisp and XML. Much help is now needed to improve this rudimentary first iteration." One thing to note is that the C++ version of the compiler came in at 4500 lines, while the XL equivalent came in at some 2700 lines. This seems to imply that XL may be easier to work in than C/C++. Might XL someday be nudging the old workhouse out of a job in the near future?
4500 vs. 2700? (Score:3, Funny)
Re:4500 vs. 2700? (Score:3, Insightful)
To me, "better" means to more readable, more maintainable, compiles to better object core, etc, etc.
Who cares how many lines it needs?
Re:4500 vs. 2700? (Score:3, Interesting)
Re:4500 vs. 2700? (Score:5, Interesting)
I would tend to disagree. There have been many studies that show that the same programmer will on average produce approximately the same number of codes in any given language. A language that offers better abstraction, will therefore give higher programmer efficiency.
To me, "better" means to more readable, more maintainable, compiles to better object core, etc, etc. Who cares how many lines it needs?
True, there are other considerations. Python will usually make you more efficient than, say C++. But well-crafted C++ code is likely to run faster. The holy grail is good abstractions, easy (but safe) low-level access, small run-time, and fast code. I wouldn't be surprised if concept programming was a step in the right direction.
Re: LOC isn't everything (Score:1)
Re:4500 vs. 2700? (Score:3, Insightful)
Re:4500 vs. 2700? (Score:4, Interesting)
Yes! You nicely pointed out some of the reasons for a standard syntax tree representation [sf.net] in XL. The properties you mention (accessibility to third-party tools, persistence, representability to the programmer ("rendering"), extensibility (more data than in the source)) are all important, and discussed on the Mozart web site.
The "new" XL compiler, the one that bootstrapped, is an attempt at vastly simplifying that tree representation. It's now down to 7 node types.
Re:4500 vs. 2700? (Score:2)
So, in that particular case, I believe that the difference really represents a difference in the level of abstraction.
Re:4500 vs. 2700? (Score:1)
Re:4500 vs. 2700? (Score:1)
Re:4500 vs. 2700? (Score:1)
Huge? Hardly. Statistically speaking, it's barely significant. It's
within one order of magnitude, for crying out loud.
If they'd written it in Perl, it'd be three hundred lines including comments
and some clown over at perlmonks.org would be trying to golf it down small
enough to fit into a signature.
Lines of Code (Score:1)
if (X == Y)
{
Z = X * 2;
return Z;
}
I'd be happier if the braces were in the language... using white space seems intangible.
Re:Lines of Code (Score:2)
In XL, braces are used for pragmas, i.e. compiler plug-ins. If you write {derivation} dsin(x)/dx, it tells the compiler to hand over the dsin(x)/dx parse tree to the derivation plug-in. See http://mozart-dev.sf.net/derivation.html for an example.
For program structure, I prefer to use
XL? (Score:2, Funny)
"be a calculator"
and that was it, I'd be so happy!
Re:XL? (Score:4, Funny)
"When someone says "I want a programming language in which I need only say what I wish done," give him a lollipop."
-- Alan Perils
:)
Re:XL? (Score:2)
Re:XL? (Score:2)
"be a calculator"
and that was it, I'd be so happy!
That will almost work.
Unfortunately the user interface of the calculator leaves a little to be desired. For instance to add "2 + 2", you need to do the following:
type "mov ax, 02" followed by <enter>
type "mov bx, 02" followed by <enter>
type "add ax, bx" followed by <enter>
type "push ax" followed by <enter>
type "call DECIMAL_OUTPUT_ROUTINE" followed by <enter>
type "
Re:XL? (Score:2)
Computer: "To be or not to be a calculator, that is the question."
Re:Meanwhile, in Cally-forn-ee-ah (Score:1, Offtopic)
So the rumors are true! There is at least one Republican on Slashdot!
Take that, you stereotypers of Slashdot!
.NET (Score:2)
I often wish to use programming languages other than C++, but the library bindings aren't there.
For example, I'm currently struggling to use libkabc from C# so I can use the kontact name and addressbook.
Re:.NET (Score:1)
From what you're trying to do, I guess you are using Mono (am I right?). Isn't there some sort of Managed C++ for Mono? You might find it eas
Re:.NET (Score:4, Interesting)
Unix started down this road with 'everything is a file' but failed to follow through on that promise.
When the Unix creators decided to take what they already knew and start again, 'everything is a file' became a design philosophy.
Consequently, devices can be accessed through the file system [bell-labs.com]
One can draw to a screen [bell-labs.com] via files, or open a internet network connection [bell-labs.com]
The magic for all off this is a unified protocol 9p [bell-labs.com]. All file access is via 9p so if your program can speak 9p it can serve files to anyone. One binds a programs namespace into your own and off you go. The network becomes utterly transparent.
In this way one waves bye bye to bindings and other marshalling techniques, who needs 'em.
If your programming language can open and read and write files, it can do anything.
It is just one of the many benefits that plan9 has brought to us.
Too bad people are letting it slip past them.
Re:.NET (Score:2)
If your programming language can open and read and write files, it can do anything.
Forgive me and call me dense, I don't get it yet. Where does the philosophy of "everything is a file" buy you much over "everything is a network connection"?
It still seems like there's a lot of work to be done in higher level layers on the raw interface so you can build things with more logic in them (think of odd beasts like SQL servers, SMTP, authentication servers, etc.). These "files" still behave differently and an a
Re:.NET (Score:2)
The point I was specifically addressing, binding's to the gui components, serves as a good example.
The poster was crowing about
Re: Plan 9 (Score:1)
Re: Plan 9 (Score:3, Interesting)
The user base, as monitored by newsgroup traffic, has been very slowly growing, a few more peop
Re:.NET (Score:2)
600 vs 800? (Score:3, Funny)
I gotta say ... (Score:2)
Of course, I didn't actually read any of it, so it could actually be damn cool. I'm personally of the opinion that we've yet to see a language that doesn't suck in one way or another...
Maybe this is The One (tm)
Re:I gotta say ... (Score:2)
Getting it up to the production quality needed to compete with C++ is much more than a one-man task, though. And chances are it will die out like any other MFTL-project. But I would like to give him the benefit of doubt on this one.
Re:I gotta say ... (Score:2)
That's not what I see. It looks much more like an updated version of Ada to my eyes. Even the claims made are very similar to those made against C++ when Ada95 was new-fangeled and against C when Ada was born.
Re:I gotta say ... (Score:2)
XL took from Ada a few ideas of syntax, those that I believed improved legibility. That's about it. What are the "claims" you are talking about?
Re:I gotta say ... (Score:1)
Re:I gotta say ... (Score:2)
... Guess why I posted a story on Slashdot? Anybody interested in helping?
Re:I gotta say ... (Score:2)
And I bet I'll last more than 6 months [sourceforge.net]. I raise the stakes: one free copy of Linux for every user of Slashdot if I've given up in 6 months.
So exactly what is the language? (Score:3, Insightful)
Re:So exactly what is the language? (Score:3, Informative)
Re:So exactly what is the language? (Score:1)
My other test is what a Space Invaders program looks like. It would have to deal with drawing, responding to user input, timers etc.
Re:So exactly what is the language? (Score:2)
The bootstrap compiler doesn't need objects, so it doesn't really implement them (and it's partially implemented in the old, non-boostrapped compiler). The language design has them. See http://mozart-dev.sourceforge.net/xl_features.htm, notably "Data inheritance", "Logical inheritance", "Function based dynamic dispatch".
I'm sorry, I can't tell you (Score:2)
Re:I'm sorry, I can't tell you (Score:2)
hacker site!!! (Score:3, Funny)
That logo means this guy is a hacker (no, not the kind that break into computers illegally, the kind that have scrawny mustaches and like to shoot people with guns. Excuse me, like to shoot guns, not necessarily at people. But keep an eye on them anyway if you're a teacher or parent.)
Wow, anybody kool enough to use the neat-o hacker logo must have like the most AWESOME program evarrrrr!
This is only the beginning (Score:2)
No it doesn't. (Score:2)
That's just silly. An APL version of it might be only 20 lines long, but it wouldn't be easier to work with because of that.
Re:No it doesn't. (Score:2)
It would also be possible to write it in one line in C++. A long line, though. However, if you actually look at the code by following the "Browse CVS" link on the web page, you will see that the XL code doesn't look anything like APL.
I realize the limitations of LOC statistics. But I'm still happy to discover that, without any particular effort on my part, code written by the same
Re:No it doesn't. (Score:2)
XL looks like a fairly nice language, frankly, but just being more concise isn't a recommendation.
A Quick Glance (Score:4, Interesting)
I did not see support for "iterators" mentioned directly, but if the extension mechanism is strong enough that should be doable.
I'll be taking a careful look at it myself. These are some very powerful features. (Sather had many of these and was (in my experience) the best language I've ever used.) If C# had only put in decent syntax for some of these things I could have been persuaded that Microsoft was not the SAOE (Software Axis Of Evil), but they didn't.
Re:A Quick Glance (Score:3, Informative)
for <some expression> loop
and the compiler looks for an iterator that matches . This is how for I in 1..5 loop or for element in array loop are implemented.
In other words, iterators are directly used by the compiler in for loops. This doesn't work in the bootstrap compiler (yet).
Mozart vs XL (Score:2)
I would prefer iterators the way Sather did it though :
i
end ;
User Interfaces for programmers (Score:2, Informative)
"Concept"-based programming is the only programming people do.. In non-buzzword terms, it's abstraction. Whether you abstract over code, or data, semantic or syntax... it's all basic abstraction. I read the code for the compiler itself, and didn't really see the kind of abstraction I really wanted to see..
I've taken a stab at this kind of mutable language, and I'm sure more than a few others have, but there's always something missing. It's the same problem that occurred in one of the original mutable la
Re:User Interfaces for programmers (Score:5, Informative)
No. Concept-programming focuses on the limits of abstractions, and consequently on the techniques that help building better abstractions. Concept programming is not what people do. I wish, but it just ain't so. This is discussed ad-nauseam on the Mozart web site.
I read the code for the compiler itself, and didn't really see the kind of abstraction I really wanted to see.
This is really interesting to me. What kind of abstraction would you have wanted there? Please note that the bootstrap compiler is very limited, like any bootstrap compiler, so I can't make use of many fancy features of the "theoretical" XL. But I'm relatively proud of the "translate" extension, for instance (http://xlr.sf.net/031105.html). I think this is a good example of higher-level abstraction. And it's what makes the XL version shorter than the C++ one.
While you can go ahead and create domain specific abstractions with syntax, the code to implement a nontrivial abstraction with reasonable semantics and syntax is equally or *more* complex than just using either domain specific tools separately, or using basic functional abstraction in the first place.
That is just not true. One data point: the symbolic derivation in XL (http://mozart-dev.sf.net/derivation.html) is a few hundred lines of code. The corresponding C++ equivalent using template meta-programming is a few thousands lines of code. The derivative expansion in the source code is shorter than the derivative meta-processing code if you use it only once. Just like inlining the code of a function is shorter than adding all these pesky prototypes if you use the function only once.
You can implement every abstraction buzzword ever mentioned with functional decomposition combined with a preprocessing pass. The important part is not the mechanics, since every programming language since lisp has these mechanics.
The objection "it's easy to build, here are the tools" is not a valid one in my opinion. "It's easy to build a kernel, all you need is a C compiler". Yeah, right.
The important part is the interface to the programmer... and that's a tough problem
And that's precisely where XL and Lisp differ the most. I think XL is more accessible to a majority of programmers, and can appeal to some who would not touch Lisp with a ten foot pole. Yet under the hood, it is so much like Lisp that Lisp-enabled programmers who would not touch C with a ten foot pole could like XL.
I believe you have a good background and could add valuable contribution to the project. Why don't you try to take "one more stab" at this kind of mutable language? ;-)
Re:User Interfaces for programmers (Score:2)
Asmo
Re:User Interfaces for programmers (Score:2)
I know very little about Beta, but the little I read indicates a very powerful language, but a not very accessible one.
From a concept-programming point of view, it implements some elementary concepts in a noisy, distorted way. Take function calls as an example. I think it is important to have "A := 3" and "A(3)" be visibly different (regardless of whether you like the := syntax, for instance). From what I understand, both are written 3 -> A in Beta. This is artificial co
um... (Score:2)
With gcc/g++: had to add in a #include <unistd.h> that was missing (needed it for sbrk()); compiled fine, bootstrap died with lots of errors. (it looks like it generates lots of bad C++ code or something)
With icc: Compiled fine (modulo a few harmless warnings); bootstrap compile looks like it has hung (been going now for over 8 minutes!) -- but hey, at least it didn't die, right?
I guess I'll take another look at this one when it isn't
Re:um... (Score:2)
Well, it looks like I need to do a new build pass on Linux
Re:um... (Score:2)
With icc: Compiled fine (modulo a few harmless warnings); bootstrap compile looks like it has hung (been going now for over 8 minutes!) -- but hey, at least it didn't die, right?
I think both issues have been fixed. There were uninitialized values at a few places...
Looks more like... (Score:2)
It looks more like an object oriented Pascal variant to me than the mentioned cross of C++, Lisp and XML. Have a look at the parser source [sourceforge.net].
But it certainly looks like a nice, clean language, with lots of syntatic sugar removed: they seem to use parens only where absolutely necessary, no semicolons in sight and no curly braces anywhere... well, if you like sugar-free languages this one's for you :-)
Luckily they seem to not follow the current trend of languages without header files, since I personally think
Re:Looks more like... (Score:3, Insightful)
Regarding header files, the compiler has an "import" statement. XL has modules, with separate files for module interface and module implementation. It's not fully functional in the
C++, Lisp, XML (Score:4, Interesting)
It's not in the looks. From http://xlr.sourceforge.net/info/xl.html:
A lot of ideas come from older languages.
Think C/C++... without the syntactic and semantic complexity.
Think Lisp... without the parentheses.
Think XML... with better support for highly structured data such as program.
There are links to explanations on the original page.
Re:C++, Lisp, XML (Score:2)
If you've read any of the stories about Python on
Re:Looks more like... (Score:1)
Agree. The first thing that I thought of, looking at the source, was the unholy atrocity, sometimes referred to as Modula 5.
Learn more; Books? (Score:1)
I'm very impressed by Concept Programming & XL. It appears to capture many ideas I have had about benefits and shortcomings of pattern matching, functional programming and object orientation.
Could anyone point me to papers/books or PDF resources about this topic?
Re:Learn more; Books? (Score:2)
Just one question. (Score:1)
XL? (Score:1)
It should have been named XXL, so I could make a mint selling sweatshirts to geeks.
The pain! The pain! (Score:1, Flamebait)
Ever heard of functional programming? That's the family of programming languages lisp is in? Ever programmed in them? They are freaking painful if you ask me. It makes so much more sense to use a procedural language in everyday progra
C is forever (Score:1)
Nothing will ever get rid of C or C++. Java tried, C# tried, hell, D language [digitalmars.com] tried. When's the last time you heard of D?
Oh, and if your next question is: why would we want to get rid of C... you're kidding, right?
The web site has background pictures (Score:2)