Re: Columns in flex. (Charles Elliott)
Fri, 27 Jan 1995 03:57:58 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: (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 <> 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!




Post a followup to this message

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