views:

90

answers:

6

I worked with a C++ interpreter (CINT) and my experience was disastrous. It's full of bugs, strage behaviours, not standards... and I'm arrived to a conclusion: it's wrong to create an interpreter of a language born to be compiled because I think that the design of a language is strictly bounded to the fact that it will be interpreted or compiled.

What do you think about it?

+1  A: 

Well, my thoughts are that this is very possible. I think what you encountered is the sheer complexity of the language being interpreted. C++ has all kinds of edge conditions and other quirks even when being compiled, let alone being interpreted.

Simpler languages (think Boo, F#), while being compiled languages, can still be interpreted.

Anton Gogolev
+1  A: 

The "wrong" here is in creating an implementation that is buggy (although starting with a complex language is a bad idea); having a scriptable language does have some user-cases, but my view is that there already are plenty of scribt languages with reasonable implementations on multiple platforms. If I needed a script language, I'd probably aim to use one of those.

As an aside, IIRC the C# spec calls out that the spec anticipates to be used with a compiler, but that this is not a requirement, and that a legal interpreted version would be possible.

Marc Gravell
+1  A: 

If they were written to be compiled then why should you swim against the tide :)

zapping
A: 

No its not wrong, but why should you. Languages like C and C++ are build very close to the machine. So if you want to build an interpretor you should build a full virtual machine. Which is not wrong but there are more usefull projects.

Gamecat
+2  A: 

The only difference between a compiler and an interpreter is performance. Sure, one particular C++ interpreter is buggy, but that does not mean that all C++ interpreters must be buggy. I think this has less to do with whether C++ is "meant" to be compiled (by whom?) and more to do with the fact that C++ is a extremely difficult language to compile to begin with.

(As long as we're opining, I think that C++ should neither be compiled nor interpreted, but translated into a different language instead. But that's just me.)

Dietrich Epp
A: 

It's wrong to create an interpreter of a language born to be compiled.

Ain't no such animal. C++ was born to be a preprocessor to C, back when it used to be called "C with Classes". Any language ever created can be compiled or interpreted, although there are cases of dynamic languages that are very hard to compile efficiently. So I might buy the idea of "born to be interpreted", but never "born to be compiled".

More seriously, it's wrong to create crappy interpreters, just as it's wrong to create crappy compilers. Full stop.

What do you think about interpreter of usually compiled languages?

One of the best systems I ever used was the Saber-C system: an interpreter for C, a language which you might say was born to be compiled. It was great. I still miss it.

Norman Ramsey