Soroban - Java MixFix Calculator

Posted on by Kenny Cason
tags = [ java, calculator, mixfix, infix, postfix, parer, lexer, pratt-parser ]

A java calculator named Soroban (Japanese for Abacus).

The GitHub repository is maintained here. Command Line Calculator Tool in Java.

Contents

Todo

Example Expressions

Usage

Execute a single expression

soroban ln(E) * PI / 2

Enter Interactive mode

soroban -i

Load commands from file

Load a file of commands, one command per line, and execute them sequentially.

soroban programs/test.soro
soroban /full/path/to/file.soro
soroban -h
soroban -v

Install

Brew Install

brew install https://raw.githubusercontent.com/kennycason/soroban/master/script/brew/soroban.rb

Install (via Bash Script)

A helper script has been added to install Run. Java is required to run. The install is a single a jar from Maven Central.

bash <(curl -s https://raw.githubusercontent.com/kennycason/soroban/master/script/install.sh)

Maven Install (To include in other code)

<dependency>
    <groupId>com.kennycason</groupId>
    <artifactId>soroban</artifactId>
    <version>1.5</version>
</dependency>

Interactive CLI Demo:

> 10
10
> x = 10
10
> x + 20
30
> x * 2
20
> x ^ 10
1.0E+10
> x ^ 3
1000.0
> x / 10
10/10
> x / 10.0
1
> 3/5 + 1/5
4/5
> 3/5 + 1
8/5
> sin(rad(90))
1.0
> x = y ^ 2
y ^ 2
> x
y ^ 2
> y = 3
3
> x
9.0
> memory
x = 3 ^ 2
y = 3
> PI
3.141592653589793
> E
2.718281828459045
> ln(E)
1.0
> x = y = 10
10
comments powered by Disqus