| Crates.io | nyandere |
| lib.rs | nyandere |
| version | 0.1.2 |
| created_at | 2022-08-10 08:58:53.50697+00 |
| updated_at | 2025-08-07 03:18:48.364917+00 |
| description | i help with keeping track of purchases. meow |
| homepage | |
| repository | https://codeberg.org/MultisampledNight/nyandere |
| max_upload_size | |
| id | 642514 |
| size | 117,341 |
Finally figure out how much everyone owes each other.
If Rust is already installed,
just write cargo install nyandere!
Much like one would write an R, Julia or Python script to describe the processing some data, one can write a nyandere script like a receipt!
A script usually consists of 3 phases:
creation,
transfer and
analysis.
See asset/examples/typical.nyan
for a small typical script.
The syntax is inspired by SQL.
It is case-sensitive, though.
A rough overview, the exact description is in
doc/syntax.abnf:
A script consists of any number of statements delimited by newlines or semicolons.
#) and last until the next newline.Each statement consists of a command and arguments.
The command consists of one or more identifiers.
There are positional, named and named optional arguments.
Positional arguments have their value stated as-is and are "unnamed".
Named arguments consist of
=) padded by any number of spaces around itNamed optional arguments are shown in (parentheses).
The parameters in the commands below have the types required by them shown in PascalCase. Types can be:
| type | example | description |
|---|---|---|
Name |
someone |
Arbitrary unicode identifier |
Money |
3.14€ |
Euros. The sign needs to be explicit, also possible are ct, eur, EUR, ... |
Gtin |
12345678 |
Global Trade Item Number. Found on barcodes. See the glossary. |
Additionally, there are the types Entity, Concept and Object.
You need to explicitly create them before you can use them
(usually by name),
see the next section.
| cmd | pos | named |
|---|---|---|
create entity |
Name |
|
create concept |
Name |
price=Money gtin=Gtin |
create object |
Name |
parent=Concept |
The create command family registers new actors.
An actor
is a stateful participant
in an interaction.
They need to be created
before they can be used,
this avoids errors due to typos or the works.
An actor is one of the following:
For example,
this would create 2 entities A, B and
a concept Multikey
with the price of 1.70€ and
the GTIN 10000000,
as well as an object thing with Multikey as parent concept:
create entity A
create entity B
create concept Multikey price=1.70€ gtin=10000000
create object thing parent=Multikey
A few more caveats:
cotton
after each other, but only the last created one
is accessible by that name.| cmd | pos | named |
|---|---|---|
pay |
Money |
from=Entity to=Entity |
Transfer value, with
from as creditor (who gives it) and
to as debitor (who receives it).
| cmd | pos | named |
|---|---|---|
balance |
from=Entity to=Entity |
How much does from owe towards to,
all transfers summed up accordingly?
Terms you may stumble across when using this. These are to the best of my knowledge from what I know and found on Wikipedia:
Credit and debit work in tandem: A giving a credit to B is equivalent to B receiving a debit from A.
Sequence of transactions forming a standing value.
Accounts are called entities in nyandere. The standing values are not directly implemented: Instead relational values between each entity-pair are kept.
Moving value from or to an account. Always involves exactly one credit and one debit: The value comes from somewhere and goes somewhere.
Outgoing transaction away from an account.
A having a credit with B means that
A trusts B with some value.
Compare with Latin "credere" = to trust.
Incoming transaction into an account.
A having a debit from B means that
A has been given some value from B.
Compare with Latin "debere" = to give.
A base10 number with no leading zeroes between 8 and 14 digits long, both inclusive. Standard-wise they are actually only available in even fewer versions.
Thought for use with a barcode scanner, there's cheap used ones connectable via USB.
Licensed under either of
at your option.
Please do note that while I do hope this is useful to some, this is a project created in my personal free time. I am not a professional, nor is this a product I am selling.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.