Have you guys seen this suite of tests? https://github.com/beancount/beancount/blob/master/beancount/cparser/parser_test.cc
Any parser that supports a suite like this I'd probably want to integrate and contemplate a Rust version of Beancount. There are two crucial things at the bottom of it all: - a good parser - the ability to call to & from Python without any copies Anything else is a piece of cake. On Wed, Nov 15, 2023 at 5:17 PM Simon Guest <[email protected]> wrote: > beancount-parser-lima may do a bit more than the existing core parser in > Beancount proper. It processes all the included files and returns a > date-ordered list of all the directives, with all pragmas either processed > or returned as a single Options structure. > > It doesn't do the filling in of missing numbers, because that seems tricky > indeed (and an application level thing not a parser level thing). Nor > plugins. > > I'm currently making good progress with Python bindings, including some > performance optimisations to reduce the number of allocations of Python > objects. > > On Thursday, 16 November 2023 at 00:29:01 UTC+13 [email protected] wrote: > >> The c++ parser in V3 is pretty much done. >> This is other people writing a parser in rust. >> >> It's worth noting that n beancount the parser alone isn't that useful. >> It's because beancount processes its data in two stages: parsing, which >> produces roughly a data structure that matches the input, and then running >> over the stream of transactions to fill in missing numbers and also running >> all the plugins. The result of that is the final stream of transactions >> that you can do queries on. The logic in the second part is where all the >> complexity lies. I haven't ported that. >> >> >> >> >> On Wed, Nov 15, 2023, 04:54 Chary Chary <[email protected]> wrote: >> >>> Martin, >>> >>> is this somehow alternative to the C++ parser, which you are working on >>> in beancount v3? >>> >>> On Sunday, November 12, 2023 at 9:46:50 PM UTC+1 [email protected] wrote: >>> >>>> Thank you for sharing. Added to contrib doc. >>>> >>>> >>>> On Sun, Nov 12, 2023 at 3:15 PM Simon Guest <[email protected]> >>>> wrote: >>>> >>>>> Ahoy Beancounters! >>>>> >>>>> Of interest really only to developers, I created a new parser for >>>>> Beancount in Rust, called beancount-parser-lima >>>>> <https://docs.rs/beancount-parser-lima/latest/beancount_parser_lima/> >>>>> (because >>>>> I am aware it is not the first such). >>>>> >>>>> I'm currently actively working on this, with my current focus being >>>>> adding Python bindings. >>>>> >>>>> So far it parses everything I have tried. No support for plugins, >>>>> because, well, it's purely Rust so far! (Also no support so far for query >>>>> and custom directives, unsure how important they are.) >>>>> >>>>> Performance and rich error reporting are the two headlines. >>>>> >>>>> Hopefully this may be useful for some. >>>>> >>>>> cheers, >>>>> Simon >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Beancount" group. >>>>> To unsubscribe from this group and stop receiving emails from it, send >>>>> an email to [email protected]. >>>>> To view this discussion on the web visit >>>>> https://groups.google.com/d/msgid/beancount/d63af5c5-2670-4a65-9a88-570dabbb19fbn%40googlegroups.com >>>>> <https://groups.google.com/d/msgid/beancount/d63af5c5-2670-4a65-9a88-570dabbb19fbn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>> . >>>>> >>>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Beancount" group. >>> To unsubscribe from this group and stop receiving emails from it, send >>> an email to [email protected]. >>> >> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/beancount/c82304a1-125a-4f93-a149-5717ce010079n%40googlegroups.com >>> <https://groups.google.com/d/msgid/beancount/c82304a1-125a-4f93-a149-5717ce010079n%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- > You received this message because you are subscribed to the Google Groups > "Beancount" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/beancount/f90b32ee-8226-46c9-831d-17450ac831e9n%40googlegroups.com > <https://groups.google.com/d/msgid/beancount/f90b32ee-8226-46c9-831d-17450ac831e9n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Beancount" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/beancount/CAK21%2BhOciLhn-b%2BjBTxdp622BnWhyEtTjLQYRo6Adj5bzZvNkA%40mail.gmail.com.
