ABNF and Plain Text Accounting

Plain text accounting is a useful way to describe a machine and human readable accounting journal. Some formats are single file format and some are multiple file formats. F

The software primarily beancount and ledger transform the data into useful reports as well as validating that the data is correct in the first place.

The reports that can be run are:

Beancount documents that the clear process of converting text based records to an internal memory model is:

I am hoping to compare the syntax and show how they relate to each other as well as to alternative notations such as accounting movements.

Data formats

This is a real time format I have used:

plain-text-accounting = *(transaction / posting / balance-check / data-point)

balance-check = datetime ["%" knowledge-date-time] "balance" account amount [comment] EOL

data-point = datetime ["%" knowledge-date-time] "data" name value [comment] EOL

posting = datetime ["%" knowledge-date-time] ("*" / "transaction") *2comment EOL *(metadata / posting-leg)

metadata = "  " parameter [comment] EOL

posting-leg = " " account amount [comment] EOL

posting-id-link = " " parameter EOL

comment = ";" comment-text EOL

PTA Railroad Diagram

This is a partial description of the BeanCount Journal format:

journal = *entry

entry = comment / transaction

comment = *WSP ";" *VCHAR CRLF

transaction = header postings

postings = 2*posting

directive = value-date ["^" knowledge-date] ("*" "transaction" / "open" open-directive / "balance" balance-directive)

blank-line = CRLF

header = value WSP id CRLF

value-date = full-date / date-time

knowledge-date = full-date / date-time

posting = account [asset-class] CRLF

balance-posting = account CRLF

id = string

string = DQUOTE *VCHAR DQUOTE

account = ("Assets" / "Liabilities" / "Equity" / "Income" / "Expenses") ":" name

name = TEXT / TEXT ":" name

full-date = date-fullyear "-" date-month "-" date-mday

full-time = partial-time time-offset

date-time = full-date "T" full-time

BeanCount Journal Structure

BeanCount Directives

BeanCount Postings

BeanCount Accounts and Dates

go-luca - Movements

go-luca replaces transactions and postings with movements, inspired by Pacioli’s Credit // Debit notation. A movement transfers an amount from one account to another using an arrow operator. Linked movements (prefixed with +) group related transfers.

journal = *(movement / linked-movement)

movement = date WSP flag CRLF WSP WSP from-account WSP arrow WSP to-account [WSP description] WSP amount WSP commodity CRLF

linked-movement = movement 1*("+" from-account WSP arrow WSP to-account [WSP description] WSP amount [WSP commodity] CRLF)

date = 4DIGIT "-" 2DIGIT "-" 2DIGIT

flag = "*" / "!"

arrow = ">" / "->" / "//"

from-account = account

to-account = account

account = account-type *(":" name)

account-type = "Assets" / "Liabilities" / "Equity" / "Income" / "Expenses"

name = 1*VCHAR

description = DQUOTE *VCHAR DQUOTE

amount = 1*DIGIT ["." 1*DIGIT]

commodity = 1*ALPHA

go-luca Movement Structure

go-luca Accounts and Values

Multiple files - Corpus of accounts

It may not convient or practical to have a single file represent the whole of the accounting journal.

Pacioll describes having multiple books, the first one marked with a * and then A etcera.

Periods

I don’t think either hledger or beancount consider periods.

© 2018 - 2026 · Bytestone Blog · Theme Simpleness Powered by Hugo ·