Parse-O-Matic

From Parse-O-Matic Wiki

Jump to: navigation, search

Parse-O-Matic is a software product (i.e. a computer program), created by Pyroto, Inc., which can be used to convert data files from one format to another. The conversion process is guided by a series of instructions called a "script".

[edit] Example

Consider the following data file. Each record (one line of text, in this case) contains one item in a grocery list followed by a quantity.

Bread 2
Carrots 12
Soy milk 1

To parse this file into its component parts we must make logical separations based on known formatting features. Already we know that each line contains one (and only one) item. We can further observe that the final item (the number) follows the last space on each line. In Parse-O-Matic this file could be parsed as follows. (Each script line includes a comment.)

Item     = Parse $DATA '' '>* '    ; Set the item variable
Quantity = Parse $DATA '>* ' ''    ; Set the quantity variable
OutEnd 'Item:      ' Item          ; Send the item variable to the output file
OutEnd 'Quantity:  ' Quantity      ; Send the quantity variable to the output file

If this script was run by Parse-O-Matic with the grocery data file it would send the following text to the output file:

Item:      Bread
Quantity:  2
Item:      Carrots
Quantity:  12
Item:      Soy milk
Quantity:  1

[edit] Parseable Data Files

Parse-O-Matic can parse most flat data files. That is to say, it can separate data that is represented in a file by a known (or observable) well-defined logical structure.

Personal tools