[antlr-interest] philosophy about translation

Jim Idle jimi at intersystems.com
Mon Nov 6 12:05:59 PST 2006


-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Anthony W. Youngman
Sent: Thursday, November 02, 2006 1:22 AM


> And I've also used a version of DATABASIC where some bright spark 
> rewrote the system primitives in C. Blech!!!! the number of times I've 
> seen people scream because they got bitten by subtle bugs ...


As it seems somewhat likely that you are in fact talking at least in part about my own work, I feel somewhat qualified to comment:

While understanding the point you were making, and generally agreeing, the particular system that incorporated this form of DATABASIC does not allow us to use it as good example of it, at least to my mind. In the main because the subtle bugs you talk about were usually there because of some defect in the original systems ;-).

1) I haven’t seen anyone get caught by 'subtle' bugs, just plain stupid ones like all systems ;-)
2) The early versions of these rewrites in C were buggy, but it was more to do with them following the original way of doing things - hack it together and stick it out there.
3) I believe that the particular version of this system that I came up with was very much better from a bug point of view than any of the original systems or the earlier C versions, however there were many cases where the bugs were actually subtle bugs in the original hardware based systems that we had to choose to either emulate or ignore (document). 


> Come to think of it, how many people get bitten by subtle bugs in Java 
> because they don't understand that, underneath, it's written in C++? As 
> someone said, not many, because it's been well tested, but that's still 
> a few too many ...

It isn’t so much the bugs as it is causing greatly more work to be done for a task by not understanding how poorly the application has been put together as far as the machine is concerned.

> Assembler is written in assembler, pretty much without exception. 

Well, it depends what you mean. Assemblers have been written in higher level languages than assembler for quite some time :-). 

> C is written in C, pretty much without exception.
>
Much of the C runtime is of course C, but specific elements, such as functions like memchr() are very often writing in assembler. There is quite often some bootstrapping goes on of course.

> The reason for demanding that a great tool be written in itself is 
> exemplified by my databasic example above - the primitives for the 
> version I initially used were written in machine code, and followed the 
> spec. The C rewrite introduced loads of subtle bugs, because the 
> characteristics of the C environment were different. How much of Java 
> DEPENDS on the lowest layer? How much knowledge do you need to 
> understand that layer?

1) There was no spec for DATABASIC, it just happened, not quite by accident, but almost. The subtle bugs were in general not a function of the demands of the new environment, but the old one.
2) When these systems were re-written in C, there were of course new bugs but also a lot of improvements. In the version I am blamed for, a lot of the system other than the low level elements was in fact written using DATABASIC, translated to C logic, compiled to call the system primitives (written in C) from machine code. A lot of what you might call subtle bugs were actually behavioral issues in the original implementations that people got to rely on. The original systems were in fact just not that great technically but were a great idea.
3) The original systems (widely used ones that are now generally thought of as the original systems) used a micro-coded processor with a specific and (especially for the time) well thought out data area and instruction set to deal with it. The assembler code was converted into an instruction code set, interpreted by the microcode, databasic runtime was implemented in this virtual assembler, as was the interpreter for the byte code and the BASIC compiler itself. This stuff was re-implemented quite a few times and each time we discovered that there were subtle bugs in the original system that were not brought forward. That isn’t to say that there were no new bugs (just not in my code =;-) ), but the subtle ones, so to speak, were almost always caused by failing to emulate subtle bugs in the ORIGINAL system. The C re-writes merely had the same issues to deal with, though some were done better than others and it helped if you knew the originals intimately of course :-).
4) I seemed to be doomed to re-write yet another version of this system (in fact it is nearly finished) and once again the same thing applies of course. 


> I *know* I'm an expert in DATABASIC. I would *like* to *think* I'm a 
> guru, but until somebody like Jim, or Rob, or Monty, tells me I am (and 
> I probably wouldn't believe Monty), then I'm not! And even then, I 
> wouldn't believe them unless other people I trusted agreed with them.


I am sure that anyone who is wise would not trust me, but if anybody would like to experiment, with say a few million dollars... ;-)

Jim


-- 
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.430 / Virus Database: 268.13.28/518 - Release Date: 11/4/2006 5:30 PM
 


More information about the antlr-interest mailing list