A Java library and CLI tool for evaluating arithmetic expressions.
The core library provides the
ArithmeticExpression and
ArithmeticEquation classes.
ArithmeticExpression evaluates arithmetic expressions, supporting basic operations as well as parentheses for
grouping. ArithmeticEquation validates whether two expressions are equal.
To use the library in your project, add the following Maven dependency to your pom.xml file:
<dependency>
<groupId>com.nicogabriel</groupId>
<artifactId>ariee-core</artifactId>
<version>1.0.0</version>
</dependency>Alternatively, you can download the JAR file from the releases page or the Maven Central Repository.
import com.nicogabriel.ariee.core.ArithmeticExpression;
import com.nicogabriel.ariee.core.ArithmeticEquation;
void main() {
ArithmeticExpression expression = ArithmeticExpression.parse("5 + 3 * 2");
double result = expression.evaluate();
ArithmeticEquation equation = ArithmeticEquation.parse("2 + 2 = 3 + 1");
boolean valid = equation.isValid();
}import com.nicogabriel.ariee.core.ArithmeticExpression;
import com.nicogabriel.ariee.core.ArithmeticEquation;
void main() {
ArithmeticExpression expression = ArithmeticExpression.parseFile(Path.of("expression.txt"));
double result = expression.evaluate();
ArithmeticEquation equation = ArithmeticEquation.parseFile(Path.of("equation.txt"));
boolean valid = equation.isValid();
}The command line application serves as a convenience tool for evaluating arithmetic expressions directly from the terminal.
winget install arieesudo apt install arieebrew install arieeStart the interactive REPL:
arieeEvaluate a single expression (use quotes!):
ariee "5 + 3 * 2"Read and evaluate an expression from a file:
ariee -f filename.txt