An open API service indexing awesome lists of open source software.

https://github.com/furesoft/grain-expression-evaluator


https://github.com/furesoft/grain-expression-evaluator

Last synced: 4 months ago
JSON representation

Awesome Lists containing this project

README

          

# Grain Expression Evaluator

An engine to evaluate mathematical expressions written in Grain

## Usage

```grain
Scope.setVariable("n", 5, Evaluator.rootScope)
let result = Evaluator.eval("power(2,6) + pi - n")
print(result)
```

## Defining functions

```grain
Evaluator.eval("f(n) = (n * (n - 1)) / 2")
```