Re: what is flex ?

1999-03-28 Thread Will Lowe
 What is flex ?

Flex is the gnu clone of lex,  one of the original unix lexical analysis
tools.

A lexer (that's what you get when you run flex on a flex file) is used to
break up input into tokens,  which are the atomic units of programming
languages or other specifications.  In english,  tokens are probably best
thought of as words.  In something like C,  tokens are keywords (if,
else),  or numbers (1423) or operators (+, =, ;),  or function
names (do_foo()),  etc...

A decent book on compiler construction could probably explain
it better.  Compilers: Principles,  Techniques,  and Tools by Aho,
Sethi, and Ullman  (1984,  Addison-Wesley,  also called The Dragon Book
because it's got a picture of a dragon on the front) is probably the
standard compilers text.

Will


--
| [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED]   |
|   http://www.cis.udel.edu/~lowe/   |
|PGP Public Key:  http://www.cis.udel.edu/~lowe/index.html#pgpkey|
--
|   You think you're so smart,  but I've seen you naked  |
|  and I'll prob'ly see you naked again ...  |
| --The Barenaked Ladies,  Blame It On Me  |
--


Re: what is flex ?

1999-03-28 Thread Jonathan Guthrie
On Sat, 27 Mar 1999, Will Lowe wrote:

  What is flex ?
 
 Flex is the gnu clone of lex,  one of the original unix lexical analysis
 tools.

 A decent book on compiler construction could probably explain
 it better.  Compilers: Principles,  Techniques,  and Tools by Aho,
 Sethi, and Ullman  (1984,  Addison-Wesley,  also called The Dragon Book
 because it's got a picture of a dragon on the front) is probably the
 standard compilers text.

Actually, I found that the book _Lex and Yacc_ published by O'Reilly 
Associates is quite readable (I read the whole thing in two days) and is a
good introduction to things both lexish and yaccish (including bison.)
-- 
Jonathan Guthrie ([EMAIL PROTECTED])
Brokersys  +281-895-8101   http://www.brokersys.com/
12703 Veterans Memorial #106, Houston, TX  77014, USA


RE: what is flex ?

1999-03-28 Thread Ted Harding
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 --


what is flex ?

1999-03-27 Thread Àùåóëîâ Àëåêñåé
What is flex ?

Pathfinder