[antlr-interest] philosophy about translation
Anthony W. Youngman
antlr at thewolery.demon.co.uk
Wed Oct 25 04:41:36 PDT 2006
In message <D677B863-2607-4CBF-B907-32E176F9C846 at cs.usfca.edu>, Terence
Parr <parrt at cs.usfca.edu> writes
>Anyway, now make it 400 of those rules. Now, add a bunch of arbitrary
>actions that test "am I in this function and did I see this variable
>defined before by walking backwards?" in addition to these syntactic
>rules and I am certain that your brain must be very large to figure
>out the emergent behavior of all of these rules. This is the
>standard Prolog programming problem. Andy confirmed for me on the
>phone that debugging why the huge list of rules is not giving you the
>right translation requires tools that generate nice HTML reports and
>lots of thinking sometimes. Further, the constant threat of infinite
>rule-application loops frightens me. Perhaps he can give us a
>better idea of how often he hits a landmine. I may be incorrect to
>focus on this problem.
Linus and git may be an interesting example here ...
Never mind why he had to write it, Linus wrote git as a rush job source
code control system. And did it very quickly because he basically threw
all previous received wisdom out the window and started again.
It stores files based on their MD5 hash. It's theoretically possible for
several files to share a hash, and Linus said to himself "loads of sccs
code is based on dealing with the possibility of a collision, and seeing
as collisions are rare this code rarely gets tested".
So he made the *engineering* decision that (1) you never corrupt data,
so you never overwrite a file already in the sccs, and (2) the chances
of having a collision were less than the chances of the error-recovery
code going wrong, so ...
Should you get an MD5 collision, it's a fatal error. The merge fails and
the user is left to sort out the mess by hand. It seems a pretty poor
way to handle things, but at the end of the day it's a rational decision
- attempting to handle a corner case automatically is a high risk
strategy and no rational person would try. The trouble is people aren't
rational, much as we like to think we are :-)
Cheers,
Wol
--
Anthony W. Youngman - anthony at thewolery.demon.co.uk
More information about the antlr-interest
mailing list