Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!uw-beaver!ssc-vax!uvicctr!nigelh From: nigelh@uvicctr.UUCP Newsgroups: comp.unix.wizards Subject: Re: Misuse of lex Message-ID: <240@uvicctr.UUCP> Date: Thu, 12-Mar-87 17:49:39 EST Article-I.D.: uvicctr.240 Posted: Thu Mar 12 17:49:39 1987 Date-Received: Sat, 14-Mar-87 20:15:37 EST References: <339@hscfvax.UUCP> Distribution: world Organization: University of Victoria, Victoria B.C. Canada Lines: 27 > It is common to use lex to recognize a long list of reserved words > with constructs like: > options return (OPTIONS); > precedence return (PRECEDENCE); > trusted return (TRUSTED); > .... If lex were properly oriented to the user's needs, it would automatically generate a lexical analyzer that implemented an efficient look-up technique for the reserved words (hashing would be my preference). We gave up on lex a long time ago. We wrote a replacement tool, mkscan, that has abandoned the regular-expression idiom and simply provides an easy-to-use, menu-driven, full-screen interface to the user. It does things like ask the user for a list of reserved words. When you are finished, out comes a lexical analyzer that is one-third the size of the equivalent lex-produced code and runs twice as fast. Look out for a paper in a forthcoming issue of Software- Practice and Experience that describes mkscan in more detail. There is also a tool called GLA developed at the University of Colorado which handles lists of reserved words in an intelligent manner. Look at S-P&E 16 (9) 1986 for a reference to that tool. --- Nigel Horspool University of Victoria, Canada