James wrote:

> flex would let me parse files wouldn't it? at the moment i have a
> horrendous parsing routine that contains a few gotos in it (aargh :)
> and is generally really complicated ( = slow) and not nice.
> What i want parsing is similar to C source (but not the same, it
> contains blocks of data enclosed in {}s, has comments that start //
> (but can also contain useful data) but nothing is ever more than 1
> level deep, i.e 
> {
> something
> {
> some more
> }
> }
> 
> but never any deeper. FYI the data is a Quake .MAP file)
> 
> flex'd be able to handle this wouldn't it? whenever it encounters
> 'something' it needs to run some code, feeding 'something' into the
> code as a parameter.

lex/flex generate tokenisers, which match specific regular expressions
in specific contexts, and execute arbitrary code which can reference
the text which was matched.

yacc/bison generate parsers, which build a parse tree from sequences
of tokens. The token stream would normally be generated by a tokeniser
built with lex.

-- 
Glynn Clements <[EMAIL PROTECTED]>

Reply via email to