Re: Columns in flex.

schrod@iti.informatik.th-darmstadt.de (Joachim Schrod)
Tue, 31 Jan 1995 19:02:38 GMT

          From comp.compilers

Related articles
Columns in flex. Regan.Russell@jcu.edu.au (Regan Russell) (1995-01-23)
Re: Columns in flex. C.A.Elliott@dcs.warwick.ac.uk (1995-01-27)
Re: Columns in flex. c1veeru@watson.ibm.com (Virendra K. Mehta) (1995-01-27)
Re: Columns in flex. robertsw@agcs.com (1995-01-27)
Re: Columns in flex. schrod@iti.informatik.th-darmstadt.de (1995-01-31)
Re: Columns in flex. flisakow@cs.wisc.edu (1995-01-28)
| List of all articles for this month |

Newsgroups: comp.compilers
From: schrod@iti.informatik.th-darmstadt.de (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

C.A.Elliott@dcs.warwick.ac.uk (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.


Cheers,
Joachim
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Joachim Schrod Email: schrod@iti.informatik.th-darmstadt.de
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.