help-flex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: A Beginner's (probably stupid) Question


From: John
Subject: Re: A Beginner's (probably stupid) Question
Date: Tue, 8 Apr 2003 15:08:13 -0400 (EDT)

> How do exactly one do interconnection between flex and
> bison? I mean, how do the two interconnect with each other?

In two ways:

1. Bison calls the function yylex(), which should return an integer
   token. Flex's job is to generate yylex. Certain flex actions
   (section 2 of flex input) should return the current token value. In
   this way, flex actions communicate the current token value to
   bison.

2. Bison provides the global variables yylval, and yylloc. Flex
   actions may set the values of yylval and yylloc before returning a
   token. In this way, flex actions communicate additional information
   about the current token to bison.

Notice that the communication is one-way, from flex to bison.  Rarely
does it flow the other way.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]