Grammar Analysis and Description

While our discussion of CSV grammars focused strictly on the grammar of a row, our consideration of flat file grammars will focus on the logical structure of the file. Flat file record formats are usually not complex (at least in the way we will deal with them).

Before we look at the BNF, let's look at a few examples. Our sample invoice and purchase order files have the following record organization (except that the purchase order doesn't have a summary record). To focus on the structure, I use just the record IDs, and indentation shows the groupings.

HDR
SHP
 LIN
 DSC
SUM

The following example uses somewhat arbitrary record tags.

A010
B020
 C030
 D040
 E050
  F060
  G070
 H080
I090
J100

The thing that flat file formats ...

Get Using XML with Legacy Business Applications now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.