On Sun, Feb 6, 2011 at 5:47 AM, Tobias Fröschle < [email protected]> wrote:
> Am 06.02.2011 12:10, schrieb Plastic: > > For clarity: ABC#### is the format of the flight number. eg: AAL2123, >> CAL2260, FDX1001, etc... Sometimes, there are three digit flights like >> BAA418, etc... >> >> I like the way you have the parser call a function to isolate each >> component. I have until this point been thinking in terms of... >> (pseudo-code >> alert!) >> >> IF " c " INSTR(cmd$) then it's a clearance >> and >> is rightmost character x?Set expedited flag. if not, >> a$ = (right 3 characters of cmd$) (eg: "030" or " 10") (*note to self - >> this >> won't work for single digit altitudes - doh!*) >> check it makes a number >> is it a 3-digit number? (including 020 or 000) - it's a heading >> otherwise, it's an altitude. >> >> The other way I thought of doing it was parsing a character at a time and >> using the spaces as "EOFs" for each field. >> >> I am aware the decision tree for this "language" is straightforward. >> However, to me, it's not "trivial" if only because I haven't coded at this >> level in many years and this is truly stretching my mental muscles - which >> is why I am doing this ;) >> > Dave, > anything using "INSTR" is probably a bad idea before actually having > separated the command line into tokens - It ignores the position of the > command and generates a lot of false positives - If you had a "C" in the > flight#, for example, you'd understand "Climb"..... > Indeed. Seeing this problem and others is why I asked for help. I don't have an obvious solution and need to learn a better way. > About the 'language': Is this really a real life example? The distinction > between climbing and turning only done by the number of digits in the value? > Sounds a bit too much ambiguity for a high-security approach to me. If the > operator misses a single digit, he'd let the plane turn instead of climb, > with possibly fatal (lethal) results. > This also results in the fact that the decision tree for this language is > rather _not_ straightforward. Before having seen the #of digits in the > value, the language doesn't decide whether to climb or turn. (CS theory > would say "It's not a simple LR parser") > Yes, that's how most of the keyboard data entered simulators do it. It is prone to typo catastrophes. That's part of the charm of it. If you don't have the concentration to type straight, it's like not speaking clearly. It is the ATC operator's job to follow the aircraft acknowledgements and ensure the pilots heard what you intended, and not what you said ;) Dave _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm
