calcool 1.2.1

A terminal based calculator written in D


To use this package, run the following command in your project's root directory:

Calcool

A terminal based calculator based on pratt's parser and written in D

How to run?

Run it using dub package manager

dub fetch calcool
dub run calcool

You can also build this repository

cd Calcool
dub --compiler=ldc

Usage

Use in command line

Usage: calcool [OPTION] [ARGUMENT]
        -h : Print this help message
        -i : Set input file (each expression in a separate line)
        -c : Calculate the given expression

Use as a library

Add calcool to your dependencies

"dependencies": {
    "calcool": "~>1.2.0"
}

Set its subconfiguration to Library

"configurations": [{
    "name": "your app's name",
    "subConfigurations": {
        "calcool": "Library"
    }
}]

Use it in your app

import calcool.parser;

auto p = new Prser();

try {
    // You can call evaluateFromString as many times as you want
    string result = p.evaluateFromString("sin(45*2) - 22 * -exp(3)");
    writeln(result);
} catch (CalcoolException ce) {
    // CalcoolException means your expression was not valid
    stderr.writefln(ce.msg);
} catch (EndException e) {
    // Ignore EndException, it only indicates the end of parsing phase, sorry
} catch (Exception e) {
    // Something bad happened! Do what you have to do.
}

License

GPL-3.0+

Authors:
  • Alireza |S.N|
Dependencies:
none
Versions:
1.2.1 2020-Oct-02
1.2.0 2020-Jun-09
1.1.0 2020-May-10
1.0.1 2020-May-10
1.0.0 2020-May-09
Show all 6 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 2 downloads this month

  • 6 downloads total

Score:
0.8
Short URL:
calcool.dub.pm