beancount_parser_2 alpha #38
Replies: 6 comments 17 replies
-
+Beancount ***@***.***>
Looks fun. I started toying around with Rust myself.
With the Python community aiming in that direction it was unavoidable I
guess.
Plus the C++ protobuf story just isn't getting much better.
I'm wondering if there's a nicer by-ref sharing story with protos and
Rust, where an instance created in Rust can be shared to Python without
making copies (and possibly mutated).
I'd be curious to see if your parser can be made to produce protobufs.
…On Mon, May 22, 2023 at 9:51 AM Jonathan Cornaz ***@***.***> wrote:
Hi,
I started a "big rewrite" of the beancount parser: beancount_parser_2
<https://github.com/jcornaz/beancount_parser_2>
It is now in alpha. Hopefully, I'll be able to stabilize it reasonably
quickly (but there's no ETA)
This old implementation (beancount-parser) is now in "maintenance mode".
I'll still fix reported bugs, and I'll review/merge submitted pull
requests. But I won't actively implement new features on that version.
The new implementation already has some features that the old one hasn't:
- line numbers of errors
- line numbers of directives
- more convenient to destructure the result because structs expose
public fields
- can treat the account as string slices
- can use any decimal type when parsing (f64, rust_decimal::Decimal,
and more)
- can catch more syntax errors (instead of silently ignoring unknown
syntax)
- single result type (instead of an iterator over results)
- and more...
Though there are still many missing functionalities, you may want to have
a look at it ;-)
—
Reply to this email directly, view it on GitHub
<#38>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACSBE25P3LS3V464567Y5TXHNVN3ANCNFSM6AAAAAAYKPNV3Y>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
On Sat, Jun 10, 2023 at 4:56 PM Jonathan Cornaz ***@***.***> wrote:
Yes but, as much as I appreciate the benefit of protobuf and grpc when it
comes to serialization and rpc, I don't understand what benefit protobuf
brings to the table for FFI. Why not using repr(c)
<https://doc.rust-lang.org/nomicon/other-reprs.html#reprc>?
Because it's specific to a language (Rust).
Also, I don't even understand how it is at all possible. As far as I
understand, protobuf only specifies how bit are layed out in the serialized
form.
No. It also provides ser/de and bindings in many languages.
When not serialized, the message representation may differ between
languages.
Yes but with Python (and maybe Rust?) you can generate bindings to an
underlying C++ (or Rust?) representation.
That's specifically what I'm interested in, because then I can send these
data objects back and forth without incurring a copy, and this provides
most of the API surface area.
And that is even, as far as I understand, is one of the fundamental
difference between protobuf and capnproto <https://capnproto.org/>.
Protobuf is many things.
capnproto makes a different set of tradeoffs.
FWIW I'd be happy with a C++ / capnproto variant with some converters. I
started poking at this some time ago.
And the protobuf site <https://protobuf.dev/> says (emphasis is mine):
Protocol buffers are Google’s language-neutral, platform-neutral,
extensible mechanism *for serializing* structured data – think XML, but
smaller, faster, and simpler.
So far I have been unsuccessful at finding documentation and resources on
using protobuf for FFI. I'd be glad if you could share your sources.
There's no doc. It's conceptual: if most of your API surface is shallow
bindings from say, Python to an underlying C++ (or Rust) object
representation, all that's left is just a few function calls. IOW if you
can account for most of the functionality you would normally have had via
functions and getters by auto-generating access to naked data objects
you'll realize there isn't much left. It's in that sense that it covers a
good fraction of one's need for an FFI.
… —
Reply to this email directly, view it on GitHub
<#38 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACSBE5SDHNAUMB3XFXZMT3XKTNPPANCNFSM6AAAAAAYKPNV3Y>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Subscribing to the discussion as I've recently started playing around with Ledger-compatible implementation in Rust, and it seems that there is a slight chance of having parts of Beancount rewritten in Rust instead of C++, so I'd be interested in getting involved, eventually. My longer-term goal would be to have a PTA in Wasm, running in a browser, which would also provide a GUI. |
Beta Was this translation helpful? Give feedback.
-
Here's an article that may shed some light how the interop works: |
Beta Was this translation helpful? Give feedback.
-
Help me out if you care. If I can see a Rust build with some native record data structure (ideally protos or capnproto but something else fine if it works well) shared across the Python boundary (with no copy), in a bazel build --- I'll very seriously consider ditching the C++ build. rules_rust works (I've tested it already, having some issues). Rust in recent years is really taking off in the Python community and seems like a best friend to Python and a perfect fit. |
Beta Was this translation helpful? Give feedback.
-
Okay so this looks interesting, but will it build other languages? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I started a "big rewrite" of the beancount parser:
beancount_parser_2
It is now in alpha. Hopefully, I'll be able to stabilize it reasonably quickly (but there's no ETA)
This old implementation (
beancount-parser
) is now in "maintenance mode". I'll still fix reported bugs, and I'll review/merge submitted pull requests. But I won't actively implement new features on that version.The new implementation already has some features that the old one hasn't:
f64
,rust_decimal::Decimal
, and more)Though there are still many missing functionalities, you may want to have a look at it ;-)
Beta Was this translation helpful? Give feedback.
All reactions