|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. firstname.lastname@example.org (Virendra K. Mehta) (1995-01-27)|
|Re: Columns in flex. email@example.com (1995-01-27)|
|Re: Columns in flex. firstname.lastname@example.org (1995-01-31)|
|Re: Columns in flex. email@example.com (1995-01-28)|
|From:||C.A.Elliott@dcs.warwick.ac.uk (Charles Elliott)|
|Organization:||Department of Computer Science, Warwick University, England|
|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!
Return to the
Search the comp.compilers archives again.