https://github.com/akoidan/rust-spreadsheet-compiler
https://github.com/akoidan/rust-spreadsheet-compiler
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/akoidan/rust-spreadsheet-compiler
- Owner: akoidan
- Created: 2023-07-21T23:59:36.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2023-10-05T15:41:40.000Z (over 1 year ago)
- Last Synced: 2025-01-26T14:29:01.264Z (3 months ago)
- Language: Rust
- Size: 91.8 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Rust Spreadsheet compiler
A simple compiler in Rust for parsing CSV spreadsheet files with formulas, e.g.
```csv
!date|!transaction_id|!tokens|!token_prices|!total_cost
2022-02-20|=concat("t_", text(incFrom(1)))|btc,eth,dai|38341.88,2643.77,1.0003|=sum(spread(split(D2, ",")))
2022-02-21|=^^|bch,eth,dai|304.38,2621.15,1.0001|=E^+sum(spread(split(D3, ",")))
2022-02-22|=^^|sol,eth,dai|85,2604.17,0.9997|=^^
!fee|!cost_threshold|||
0.09|10000|||
!adjusted_cost||||
=E^v+(E^v*A6)||||
!cost_too_high||||
=text(bte(@adjusted_cost<1>, @cost_threshold<1>)||||
```## To run this image
#### With Docker
```bash
docker build . -t spreadsheet
docker run -t spreadsheet
```#### Natively
To run you need to have [Cargo](https://doc.rust-lang.org/cargo/getting-started/installation.html) and [Rust](https://doc.rust-lang.org/book/ch00-00-introduction.html). Please execute from the project root.```bash
cargo run ./assets/transactions.csv
```You can also run binary with
```bash
cargo build --bin transaction_parser
./target/debug/transaction_parser ./assets/transactions.csv
```