calcool 1.3.0

A terminal based calculator written in D


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

Manual usage
Put the following dependency into your project's dependences section:

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 (Exception e) {
    // Something bad happened! Do what you have to do.
}

License

GPL-3.0+

Authors:
  • Alireza |S.N|
Dependencies:
none
Versions:
1.3.1 2021-Feb-20
1.3.0 2020-Nov-22
1.2.1 2020-Oct-02
1.2.0 2020-Jun-09
1.1.0 2020-May-10
Show all 8 versions
Download Stats:
  • 0 downloads today

  • 0 downloads this week

  • 0 downloads this month

  • 35 downloads total

Score:
1.1
Short URL:
calcool.dub.pm