diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-06-03 12:02:31 +0200 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-06-03 12:02:31 +0200 |
| commit | 99e5658feb48f15f85eaf9680affea2f490459bb (patch) | |
| tree | 61fa812185892845b36792960435f79e0535043f /README.md | |
| parent | e8e86cea2bffe23961f0a1bea8ee770343894858 (diff) | |
| download | computorv2-99e5658feb48f15f85eaf9680affea2f490459bb.tar.gz computorv2-99e5658feb48f15f85eaf9680affea2f490459bb.tar.bz2 computorv2-99e5658feb48f15f85eaf9680affea2f490459bb.zip | |
Refactoring parsing, Fixing builtin, rewrite everything else
Diffstat (limited to 'README.md')
| -rw-r--r-- | README.md | 61 |
1 files changed, 60 insertions, 1 deletions
@@ -1,3 +1,62 @@ # computorv2 -computorv2 project of school 42 +Calculator REPL + +## Types + +| Name | Letter | Example | +|----------|--------|----------------------| +| Rational | Q | `1.5` | +| Complex | C | `1.5i + 1.5` | +| Matrix | M | `[ [1, 2]; [3, 4] ]` | + +Imaginary number are converted to Complex. + +## Operations + +* `+` Addition +* `-` Substraction +* `*` Multiplication +* `/` Division +* `%` Modulo +* `^` Exponent +* `**` Matrix multiplication + +| | Q | C | M | +|---|------------------------------|-------------------------|---------------------| +| Q | `+`, `-`, `*`, `/`, `^`, `%` | `+`, `-`, `*`, `/`, `^` | `*` | +| C | | `+`, `-`, `*`, `/`, `^` | `*` | +| M | | | `**`, `+`, `-`, `*` | + +## Expressions + +* Declaration + * Variable + * Function (with one parameter) +* Evaluation + +### Examples + +``` +> a = 1 + 3 +4 +> f(x) = x * 2 +x * 2 +> a = ? +4 +> f(4) = ? +16 +> f(4) + a + 5 = ? +25 +``` + +Uses eager evaluation, variable value is known after assignment, function value is reduced to the maximum (except for parameter). + +``` +> a = 3 +3 +> b = a + 3 +6 +> f(x) = 2 * 3 * 4 * x +24 * x +``` |
