On 27-Mar-99 Àùåóëîâ Àëåêñåé wrote: > What is flex ? > > Pathfinder
"Flex" performs essentially the same functions as classic UNIX "lex": it produces C code which serves as a "parser" that can be used to analyse structured input for patterns and tokens, and, for each token, generate corresponding output according to rules which you define. This is typically followed by analysing its output by C code generated by "yacc" ("yet another compiler compiler") which refers the sequence of outputs from "lex" to a "yacc grammar" which you also define. The grammar is the generative grammar for the "language" in which you write your structured input. Programs which accept structured program-like input from the user (including anything from a simple calculator which can recognise and respond to input like "1.2 + 3.14 = ?", to a full compiler for a language like C) can be composed using lex and yacc. A classic is the "eqn" component of the troff package, which generates text-formatting commands for mathematical printing when given input like "{x sup 2} over {a sup 2} + {y sup 2} over {b sup 2} = 1". The interpretation of this input is defined in the first instance by "lex" rules, and there is a "yacc" grammar for it which generates the troff code which generates the formatting when processed by troff. See the man page "man flex" (or "man lex" which gives the same), and also "man yacc". Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Date: 28-Mar-99 Time: 02:06:43 ------------------------------ XFMail ------------------------------