aboutsummaryrefslogtreecommitdiff
path: root/readme.md
diff options
context:
space:
mode:
Diffstat (limited to 'readme.md')
-rw-r--r--readme.md88
1 files changed, 85 insertions, 3 deletions
diff --git a/readme.md b/readme.md
index 827804f..66cf1a6 100644
--- a/readme.md
+++ b/readme.md
@@ -1,10 +1,92 @@
1# eva 1# eva
2 2
3> a basic calculator REPL (WIP) 3a read-eval-print-loop, similar to `bc(1)`
4
5### installation
6
7```shell
8$ git clone https://github.com/nerdypepper/eva.git
9$ cargo run
10```
11
12### usage
13
14```shell
15$ eva
16```
17
18type out an expression and hit enter, repeat.
19
20```shell
211 + sin(30)
22ans: 1.5
23
24floor(sqrt(3^2 + 5^2))
25ans: 5
26
275sin(45) + cos(0 # eva will try to autobalance braces
28ans: 3.4999999999999996
29```
30
31### operators
32
33 - binary operators: `+ - * / ^`
34 - unary operators: `+ -`
35
36### functions
37
38all trignometric functions expect input in degrees.
39conversion to radians is to be done manually (` x * 3.14 / 180`)
40
41```
42sin
43cos
44tan
45csc # cosec is for pesants
46sec
47cot
48sinh
49cosh
50tanh
51ln # log to the base e
52log # log to the base 10
53sqrt # x ^ 0.5
54ceil
55floor
56```
57
58examples:
59```
60sqrt(sin(30)) # parenstheses are mandatory for functions
61
62log100 # no
63log(100) # yes
64```
65
66### quality of life features
67
68auto insertion of `*` operator
69```
7012sin(90) # 12 * sin(90)
71ans: 12
72
73(5 + 6)(6 + 7) # (5 + 6) * (6 + 7)
74ans: 143
75
7611(12) # 11 * (12)
77ans: 132
78```
79
80auto balancing of parentheses
81```
82ceil(sqrt(3^2 + 5^2
83ans: 6
84```
4 85
5### todo 86### todo
6 87
7 - add detailed error handler 88 - add detailed error handler
8 - multiple arg functions 89 - multiple arg functions
9 - unary operators (minus, factorial) 90 - ~~unary operators (minus, factorial)~~
10 - lineeditor with syntax highlighting 91 - lineditor with syntax highlighting
92 - ~~add more functions~~