Left Overs

Opening Balance

I need a line for opening balance.

It should be input as:

{ opening: date balance }

I will skip this for now — until the tools are better — and will enter it directly into the spreadsheet.

This puts me into the manual work mode and the work that I do now will be unrecoverable and will need to be re-done every time I generate new data.

This is, also, a maintenance problem — I need to remember to re-do all of the manual work.

For now, I choose to do manual work and hope that I will remember what to re-do.

When the amount of re-doing reaches some critical mass, I will re-cast this work in automatable form. What is the “critical mass”? I have no hard definition for it — probably a factor of my boredom when re-doing work.


I need to include files.

I want to to create an output format for each parsed Transaction, and, I want these to be slightly different for the Transaction types (two). I want to use an editor to mass edit these output formats. (I ended up using a spreadsheet as the editor)l.

The SCN I’m using doesn’t have an include statement built into (i.e. there is no grammar rule for include)

Instead of extending the grammar with an include statement, I consider two simpler options:

  1. use cat from the command line (and create file snippets that can be combined)
  2. use a macro processor tool, such as M4.

I choose to use M4 for this solution. I think of using an include statement to include the output-gl*.inc files into their corresponding grasem files. M4 supports an include statement (M4 has many other features, all of which I can ignore in this solution).

Using a Spreadsheet For Rough Format

I used LibreOffice calc to rough-in the output formats for the parser.

I ended up with two files — output-gl.inc and output-glcsv.inc — due to the (slight) differences between the way that my financial institution provides statements to me.

Negative Amounts

My financial institution delivers account statements with negative amounts — in some cases, but not others.

I haven’t figured out what the pattern is, yet.

For now, I will fix this directly in output-glcsv.inc. All accounts will grow in the +ve direction.

Maybe I need to figure out — again — the difference between credit and debit and liability accounts and asset accounts. For now, I will continue to use + and -.

Parser Rule Duplication

It should be noted that I used parse rule duplication (RY).1 I let the computer do more work instead of trying to abstract my work and save computer time.

Parser Rule Duplication is the idea of using the same parse under multiple different names.

The name tells me what the parser parsed and dictates the final format of the output.

In this case, see where ${amt} appears. It appears in slightly different places depending on the transaction account (e.g. “rbc” “lit” vs. “rbc” “pro”). In typical programming languages, one would be encouraged to write complex if-then-else-code to figure out in which field the ${amt} data fits, but, using a pattern-matcher, it is easier (for me, the human) to duplicate the parser rule and make a slight change to the output format.

  1. RY means Repeat Yourself.  ↩︎