Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hacsoc/expr
An expression calculator example.
https://github.com/hacsoc/expr
Last synced: about 2 months ago
JSON representation
An expression calculator example.
- Host: GitHub
- URL: https://github.com/hacsoc/expr
- Owner: hacsoc
- License: other
- Created: 2015-09-02T20:47:55.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-03T00:10:41.000Z (over 9 years ago)
- Last Synced: 2024-04-15T01:10:51.116Z (10 months ago)
- Language: Java
- Size: 207 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Expr
By Tim Henderson
## What?
A simple expression calculator for integer math. You give it an expression:
$ expr '1 + 2'
(+ 1 2)
3It will calculate the result and additionally give you back your expression as
an s-expression.## Why?
To demonstrate gradle, testing, lexing and recursive descent parsing.
## Install
You must have java 1.7+ and git on your system. Get those first!
$ git clone https://github.com/hacsoc/expr.git
## some output
$ cd expr
$ ./gradlew test installApp
## bunch of output
$ ./build/install/expr/bin/expr '1+2'
(+ 1 2)
3To make it available for this session run
$ export PATH=$(pwd)/build/install/expr/bin:$PATH
Now you can just run
$ expr '4 * 3/5'
(/ (* 4 3) 5)
2To "install" permanently do
$ echo "export PATH=$(pwd)/build/install/expr/bin:$PATH" >> .bashrc