Rust ledger

55 views
Skip to first unread message

Martin Michlmayr

unread,
Oct 29, 2025, 6:35:16 AM (8 days ago) Oct 29
to ledge...@googlegroups.com
I saw on GitHub that there's a new Rust port of Ledger being worked
on.

Can I ask what the plan is for this port? Is this going to be a 100%
compatible port (i.e. the current test suite will pass eventually), a
partially compatible port or a completely redesigned, ledger-like thing?

The reason I ask is that ledger has a lot of variability in its file
format and maybe this Rust port would be a good time to start fresh
and make some things more streamlined. (Then again, I'm sure many
people would see value in a 100% compatible drop-in replacement.)

[1] https://github.com/ledger/rledger

[2] If it will be 100% compatible, the test suite of ledger2beancount
might be beneficial to developers. I've tried to support all of the
syntax features of ledger (if something is missing, please file a
GitHub issue).
--
Martin Michlmayr
https://www.cyrius.com/

John Wiegley

unread,
Oct 29, 2025, 5:43:44 PM (8 days ago) Oct 29
to Martin Michlmayr, ledge...@googlegroups.com
>>>>> "MM" == Martin Michlmayr <t...@cyrius.com> writes:

MM> I saw on GitHub that there's a new Rust port of Ledger being worked on.
MM>
MM> Can I ask what the plan is for this port? Is this going to be a 100%
MM> compatible port (i.e. the current test suite will pass eventually), a
MM> partially compatible port or a completely redesigned, ledger-like thing?

Hi Martin,

This port is an AI experiment, if you will. I spent several hours building a
translation scenario, and this was the outcome. Reading some of the core math
functions, it seems to have done a pretty good job. Now I’m handing it to the
community, to see if they are interested in taking it to completion.

So it’s to that community to decide what it will become.

MM> The reason I ask is that ledger has a lot of variability in its file
MM> format and maybe this Rust port would be a good time to start fresh and
MM> make some things more streamlined. (Then again, I'm sure many people would
MM> see value in a 100% compatible drop-in replacement.)

I was hoping for an entirely compatible port, so that I could shift my own use
of ledger to rledger, and then start doing maintenance work there (which would
be of much greater interest to me than working in C++).

John

Martin Michlmayr

unread,
Oct 30, 2025, 12:23:49 AM (7 days ago) Oct 30
to ledge...@googlegroups.com
* John Wiegley <jwie...@gmail.com> [2025-10-29 14:43]:
> I was hoping for an entirely compatible port, so that I could shift
> my own use of ledger to rledger, and then start doing maintenance
> work there (which would be of much greater interest to me than
> working in C++).

Would it be possible to split the parsing code into a separate Rust
library (ideally with a Python interface on top), so others can use
that to parse ledger files? It would be great for ledger2beancount to
use such a library instead of doing its own parsing.

John Wiegley

unread,
Oct 30, 2025, 2:17:17 AM (7 days ago) Oct 30
to Martin Michlmayr, ledge...@googlegroups.com
>>>>> "MM" == Martin Michlmayr <t...@cyrius.com> writes:

MM> Would it be possible to split the parsing code into a separate Rust
MM> library (ideally with a Python interface on top), so others can use that
MM> to parse ledger files? It would be great for ledger2beancount to use such
MM> a library instead of doing its own parsing.

Sure, it would be nice if the Rust port made every major aspect of the
functionality into its own crate.

John

Simon Michael

unread,
Oct 31, 2025, 2:35:09 AM (6 days ago) Oct 31
to ledge...@googlegroups.com
On 2025-10-29 00:35, Martin Michlmayr wrote:
> I saw on GitHub that there's a new Rust port of Ledger being worked
> on.
>

Nifty!

https://github.com/tackler-ng/tackler and
https://github.com/zhang-accounting/zhang
(and a few more at https://plaintextaccounting.org/#pta-apps)
are also in rust, for interest.


Clayton Carter

unread,
Oct 31, 2025, 1:57:26 PM (6 days ago) Oct 31
to Ledger
> I saw on GitHub that there's a new Rust port of Ledger being worked
> on. 

John was generous enough to give me permission to push to that branch and the
rledger repo. I've been using Ledger for a few years, have some Rust experience
and have written a few ledger adjacent tools in Rust[1]. I've been tinkering
with it and pushing updates. I believe it's currently passing just over 5% of
the regular test suite. That's up from 0% a few weeks ago, but still has a long
way to go: things like automated and periodic transactions are parsing but not
really working, ditto for many directives. Most subcommands, reports and command
line options are either not implemented, yet, or just stubbed for now. But there
is a building application w/ tests that work, so it's been a gratifying
experience to work on.

> I was hoping for an entirely compatible port,

I think that this would be wise, or as close to 100% compatible as possible. Not
only would that ease the update experience, but doing so could – in theory – allow
the project to ship a rewrite/port incrementally: perhaps replacing the C++
parser with a Rust-based-parser, and then expanding out from there, for example.

> Would it be possible to split the parsing code into a separate Rust
> library

I agree that it would be a great to ship a "reference implementation" parser for
general consumption by the community! I've been using another ledger parser for
some of my projects, and would love to use an "official" implementation.

> test suite of ledger2beancount

Noted! Thank you for the heads up! It's been nice to have the existing test
suite to work against and a project like this would benefit from as many
acceptance tests as possible.

Clayton


Reply all
Reply to author
Forward
0 new messages