Re: Columns in flex. (Joachim Schrod)
Tue, 31 Jan 1995 19:02:38 GMT

          From comp.compilers

Related articles
Columns in flex. (Regan Russell) (1995-01-23)
Re: Columns in flex. (1995-01-27)
Re: Columns in flex. (Virendra K. Mehta) (1995-01-27)
Re: Columns in flex. (1995-01-27)
Re: Columns in flex. (1995-01-31)
Re: Columns in flex. (1995-01-28)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Joachim Schrod)
Keywords: flex, Cobol
Organization: TH Darmstadt, FG Systemprogrammierung
References: 95-01-051 95-01-087
Date: Tue, 31 Jan 1995 19:02:38 GMT (Charles Elliott) writes:
> [Q: column sensitive scanning in flex? A: track them in the actions]
> In the Bison/Yacc part, simply have a semantic instruction that
> compares the value of the variable with the correct amount - obviously you will
> have to declare the variable as an extern to be able to use it in both modules.
> If there is a better way, please let me know!

Two small comments:

  * Bison provides the `@N'-Feature to access line/column for
start/end of columns. Read the sections (info nodes) ``Textual
Positions of Tokens'' and ``Special Features for Use in Actions'' of
Bison's documentation for more information.

  * In my experience, it's better to update the column information in
one of the flex supplied hooks, eg, in YY_USER_ACTION. You have to
pay attention to yyunput(), yyless(), and yymore(), 'though. But then,
they don't occur in every action, and it's more easy to maintain the
resulting code.

Joachim Schrod Email:
Computer Science Department
Technical University of Darmstadt, Germany

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.