miladz68 / staking-rewards-challenge

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Staking Reward Challenge

Originally challenge is described here.

Solution

This is not a complete solution but I think it is enough to show how I would approach solving such a problem and also some implementations of sub-problem.

I was thinking the problem will have sub parts namely:

  • csv parser: parses csv and allows the cell resolver to interact with the contents of the file
  • cell resolver: can be used to retrieve each cell information
  • expression parser: parses an expression and generates a expression type
  • expression evaluator: reduces an expression as much as possible.

In this repo I have defined expression types and provided an implementation for expression evaluator. The overall flow expression types will be generated by expression parser and passed down to expression evaluator is as follows:

flowchart TD
    CSV[Parse CSV File] --> CELL[Create CellResolver] --> PARSEXP[Parse Expressions] --> GENTYPE[Generate Expression Types] --> EVALEXP[Evaluate Expressions] --Resolve References--> CELL
    EVALEXP --> END[Generate Output File]
Loading

About


Languages

Language:Go 100.0%