|Parsing fixed-layout screens firstname.lastname@example.org (1995-07-26)|
|Re: Parsing fixed-layout screens email@example.com (1995-07-31)|
|From:||firstname.lastname@example.org (Charles Elliott)|
|Organization:||Logica UK Ltd|
|Date:||Mon, 31 Jul 1995 11:04:11 GMT|
email@example.com (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.
* My opinions are my own
Return to the
Search the comp.compilers archives again.