Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site sbcs.UUCP Path: utzoo!watmath!clyde!akgua!sdcsvax!dcdwest!ittvax!decvax!harpo!ulysses!mhuxl!houxm!hogpc!houti!ariel!vax135!floyd!cmcl2!philabs!sbcs!debray From: debray@sbcs.UUCP Newsgroups: net.lang Subject: Re: Lexical analyzers and parsers Message-ID: <628@sbcs.UUCP> Date: Mon, 14-May-84 17:35:42 EDT Article-I.D.: sbcs.628 Posted: Mon May 14 17:35:42 1984 Date-Received: Thu, 17-May-84 05:31:57 EDT References: <174@ccieng2.UUCP> Organization: SUNY at Stony Brook Lines: 34 > Any language that you have to parse most of a line and then back > up to find the token (like fortran) has severe brain damage. > Consider: > > IF(I.EQ.2)22,23,22 > > It isn't until we hit the first comma that fortran realizes it is > not looking at an identifier! It then realizes that an identifier > cannot be followed by a comma, and backs up looking for a reserved > word!!!!!! (1) I agree that FORTRAN isn't a dream language. It's been years since I've touched the language, but if memory serves me right, FORTRAN identifiers can't have special symbols like '(' and '.' in them, so I'm not sure how valid the above example is. The DO statement, DO 100 J = 1, 10 might be the example you're looking for. (2) In general, backing up in execution is a pretty messy affair, and to my knowledge, only one language, Prolog, does a decent job of it. The problem, of course, is with undoing global changes, e.g. to the symbol table. In the above example, though, it would seem that simply increasing the amount of lookahead would take care of the problem. -- Saumya Debray, SUNY at Stony Brook uucp: {cbosgd, decvax, ihnp4, mcvax, cmcl2}!philabs \ {amd70, akgua, decwrl, utzoo}!allegra > !sbcs!debray {teklabs, hp-pcd, metheus}!ogcvax / CSNet: debray@suny-sbcs@CSNet-Relay