Re: Columns in flex.

C.A.Elliott@dcs.warwick.ac.uk (Charles Elliott)
Fri, 27 Jan 1995 03:57:58 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: C.A.Elliott@dcs.warwick.ac.uk (Charles Elliott)
Keywords: flex, Cobol
Organization: Department of Computer Science, Warwick University, England
References: 95-01-051
Date: Fri, 27 Jan 1995 03:57:58 GMT

Regan Russell <Regan.Russell@jcu.edu.au> writes:


>Q: How do I do column sensitive scanning in flex ?
>Q: Or should I write my own scanner ?


There may be other (better?) ways of doing this, but I am currently writing a
static checking tool for assembly language that is column sensitive, and I do
it this way.


Have a variable that keeps track of the column that you are currently on.
Against every rule in Flex, have an instruction that increments this variable
by the correct number. When you come across a carriage return, reset this
variable. 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!


Cheers,


Charles
---
cae@dcs.warwick.ac.uk




--


Post a followup to this message

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