|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] RE:On Thu, 21 Mar 2002, Eddy Quicksall wrote: > That would be ok for something like an expression parser but our parser > should be very simple minded and it is better if it is not context > sensitive. It is the same idea as "don't use two characters". While I agree simple is good, there has to be some sort of context senstivity. I mean you have to figure out if you have one value or a range, don't you? How do you do that? Don't you parse one number and then look at the next character to decide if you have a range or not? If the next character is the range-indicating character, you remove it from the stream and then call the number parser again, don't you? Given that, how is using a '-' a problem? It's the exact same code (hardware or software) as using ';', just a different constant. Since I really doubt algebraic expressions will ever be valid, the sequence " ... number '-' number ... " can never mean anything other than a range. So how is that hard for even a simple parser to deal with? Also, I think you've assumed that: 1) we should use '-' either for negative numbers or for ranges not both, and 2) that we would rather use '-' for negative numbers than for ranges. While I don't care much about the first assumption, if we have to choose between ranges using '-' and negative numbers, ranges seem to make more sense to me here. Most programs accept them, and it's a rather intuitive way to express them. Also, are we really ever going to need negative numbers? SCSI doesn't have them. IP doesn't. TCP does not. Since those protocols use unsigned numbers, why would we need signed? > Also, the "looks" of it is not very important. I think you took my use of "look" at too simplistic a level. I did not say aesthetics. :-) My use of "look" reflects parsability of text. If something "looks" like something else, I'm saying it's more difficult to distinguish the two interpretations in a parser (you need extra context which we both agree is usually bad). If things "look" like each other, it's harder to tell them apart. We don't want that, in order to keep the parser simple as you mentioned above. Thus "looks" are important. Take care, Bill
Home Last updated: Thu Mar 21 14:18:12 2002 9251 messages in chronological order |