Shell calculator in C++ using boost::spirit
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
Makefile
README.md
calc.cpp

README.md

Copyright (C) 2015 Łukasz Czerwiński

Calc

Shell calculator in C++ using boost::spirit

Website

https://github.com/wo3kie/calc

Requirements

C++11
boost

How to build it?

make

How to run it?

Operators
+, -, *, /
^
==, !=, <, <=, >, >=
!, &&, ||
()

$./calc "1+2*3"
7

$./calc "2^3^2"
512

$./calc "1||(1/0)"
1

Functions
sin, con, tan
ln, log2, log10
rad, deg
abs
e, pi

$./calc "sin(rad(45))"
0.707107

$ ./calc "pi()*e()"
8.53973

Placeholders
_0 - number of arguments
_1, _2, ... _9 - placeholders

$./calc "_1+_2" 1 2
3

$ ./calc "(_0==3)&&(_1+_2+_3)" 5 10
0

./calc "(_0==3)&&(_1+_2+_3)" 5 10 15
30