
Compilers Targetting Parrot - draegtun
http://wknight8111.blogspot.com/2010/05/compilers-targetting-parrot.html
======
RiderOfGiraffes
This returns me to the question I asked here:
<http://news.ycombinator.com/item?id=1361382>

If I'm compiling, what should I target?

I could target LLVM, C, some high-level compilable langauge, or now, Parrot.

There doesn't seem to be any cogent, clear, knowledgable discussion of the
various features and merits. I suppose asking for one is like asking "which
language is best," and the answer will always be "it depends."

~~~
stefano
I've used Parrot as a target for a language implementation. It supports a lot
of stuff out of the box (even multimethods!) and it's quite easy to get
started. It also provides tools to help you build a compiler, like a parser
generator integrated with the rest of the system. The problem is that right
now it is quite slow, slower than Perl or Python, and a bit buggy. It would be
an ideal target platform for dynamic languages otherwise. I wouldn't use it
for something needed in production at the moment.

~~~
WalterGR
> a bit buggy

Anything off the top of your head that you've been bit by?

~~~
stefano
Threading just doesn't work (it's going to be rewritten from scratch).
Sometimes there are segfaults within managed code and sometimes there are
memory leaks. Sometimes an assertion in the VM fails, causing the program to
halt with a stack trace. A few releases ago the compiler of Parrot's assembly
language reported wrong line numbers in error messages, but this has been
fixed.

~~~
WalterGR
All those "sometimes" seems to suggest that Parrot is much more than a bit
buggy.

A memory leak is one thing, but segfaults and assertion failures... Down to
brass tacks: is this thing usable in its current state?

~~~
stefano
> Down to brass tacks: is this thing usable in its current state?

Experimentation and quick and dirty prototypes? Yes. Production code? No.

------
avar
Parrot's been claiming that it's slow and incomplete now, but a solution to
that is just around the corner for a few years.

Maybe that's true, but I think that'd be the main concern of any compiler
writer thinking of targeting it. It's not a mature platform with known pros
and cons, unlike the JVM or LLVM.

I hope it all turns out for the best and Parrot delivers on its promises. But
I can see why e.g. the PHP team isn't rushing to target it given the state of
its native languages.

~~~
j_baker
These things take a long time. Heck, it might even be a bit early to call LLVM
mature. Sure, it supports a C and C++ compiler, but I don't think it has
anything production-ready for much else.

~~~
avar
It's in extensive use by Apple on the iPhone and in XCode, and outside Apple.
The JVM is also well understood and widely deployed.

By comparison the Parrot project with the widest use is Rakudo, which is still
just at a testing stage. Maybe there's some larger user of Parrot that I
haven't heard about, so correct me if I'm wrong.

~~~
chromatic
Lua 5.2 has been feature complete on Parrot for years. Like LLVM and the JVM,
we'll keep tuning and improving and fixing bugs and adding features to make
language implementation easier, but the correlation between "maturity" and
"use" is strong.

~~~
avar
That's interesting. Are there any recent benchmarks of Lua on Parrot v.s.
LuaJIT? The only thing I could find was this from 2007 where it was ~2 orders
of magnitude slower:
[http://www.nntp.perl.org/group/perl.perl6.internals/2007/09/...](http://www.nntp.perl.org/group/perl.perl6.internals/2007/09/msg40359.html)

The URL to the benchmark script was broken so I couldn't run it.

Don't get me wrong, I think Parrot's very neat. But I could see why compiler
implementors would be sceptical of it since it's not feature complete, and
seemingly not very optimized. So there's a lot of unknowns.

