[Mono-list] Using the JB2Csharp port for Mono "requires" a flex scanner

Miguel de Icaza miguel@ximian.com
07 Sep 2001 12:21:44 -0400

> JB was built with the assumption that you would have both a flex lexical
> grammer and a bison syntactic grammar.  You used Jay and only have the
> syntactical grammer.  The lexical grammer is in cs-tokenizer.cs code (I
> beleive).

That sounds strange.  JB should just have an "interface" to the
scanner, and the scanner should be fully pluggable (look at the way
Jay does this).  

It is even pluggable in the C world ;-)

> I am wondering if you inteded to make a cs.lex, the flex grammer, in order
> to use any JB port.  Or maybe you have one that you made, but didn't put
> into CVS.  I would like to test the JB port on mono's grammers.

Nope.  There is little point in using flex for this, as our hand-tuned
scanner is probably easier to maintain/optimize than a flex scanner.

> If not, how do you suggest I most easily make one?  I think the
> cs-tokenizer.cs might be easily transformed into a cs.lex, but maybe you
> know an easier way.

The correct solution is to have an "interface" to talk to the
tokenizer (just like Bison on Unix does, or just like our lexer
interface in Jay works).

The lexer (and those generated by flex) are only pieces of code that
return integer "tokens", the interface is pretty much this:

	int get_next_token ()

So there should really be no dependency in anything other than
something simple.