Re: Parsing fixed-layout screens (Charles Elliott)
Mon, 31 Jul 1995 11:04:11 GMT

          From comp.compilers

Related articles
Parsing fixed-layout screens (1995-07-26)
Re: Parsing fixed-layout screens (1995-07-31)
| List of all articles for this month |

Newsgroups: comp.compilers
From: (Charles Elliott)
Keywords: parse
Organization: Logica UK Ltd
References: 95-07-160
Date: Mon, 31 Jul 1995 11:04:11 GMT (Roland Paterson-Jones) wrote:

>Does anyone know of any tools or techniques for parsing forms-type
>documents/screens, where certain elements at specific locations are required
>(to be parsed)?

>This might have the same answer: Are there any established techniques for
>parsing column-based languages such as fortran/pascal?

I did this using Flex and Bison, for an assembly language that
required comments in column 50, opcodes in 2 etc. The BNF
specification ignored the layout, and this was put into Bison for the
syntac checking element. The lexer then worked out the starting
position of the token it had just found (by simply incrementing a
variable and resetting it at a newline). This variable could then be
read in Bison via a semantic rule and errors checked for.

This method also avoids failures from Bison due to incorrect spacing
(it will only generate user entered messages in the semantic rules)
and helps error handling procedures. Bison provides a structure in
which to place this information (both column and line) but it is just
as easy to declare your own variables (although perhaps not as neat).
I forget the name of the Bison structure, but it is in the manual.

Mail me if you need any more info.


Charles Elliott

* My opinions are my own


Post a followup to this message

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