diff options
Diffstat (limited to 'readme.md')
-rw-r--r-- | readme.md | 88 |
1 files changed, 85 insertions, 3 deletions
@@ -1,10 +1,92 @@ | |||
1 | # eva | 1 | # eva |
2 | 2 | ||
3 | > a basic calculator REPL (WIP) | 3 | a 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 | |||
18 | type out an expression and hit enter, repeat. | ||
19 | |||
20 | ```shell | ||
21 | 1 + sin(30) | ||
22 | ans: 1.5 | ||
23 | |||
24 | floor(sqrt(3^2 + 5^2)) | ||
25 | ans: 5 | ||
26 | |||
27 | 5sin(45) + cos(0 # eva will try to autobalance braces | ||
28 | ans: 3.4999999999999996 | ||
29 | ``` | ||
30 | |||
31 | ### operators | ||
32 | |||
33 | - binary operators: `+ - * / ^` | ||
34 | - unary operators: `+ -` | ||
35 | |||
36 | ### functions | ||
37 | |||
38 | all trignometric functions expect input in degrees. | ||
39 | conversion to radians is to be done manually (` x * 3.14 / 180`) | ||
40 | |||
41 | ``` | ||
42 | sin | ||
43 | cos | ||
44 | tan | ||
45 | csc # cosec is for pesants | ||
46 | sec | ||
47 | cot | ||
48 | sinh | ||
49 | cosh | ||
50 | tanh | ||
51 | ln # log to the base e | ||
52 | log # log to the base 10 | ||
53 | sqrt # x ^ 0.5 | ||
54 | ceil | ||
55 | floor | ||
56 | ``` | ||
57 | |||
58 | examples: | ||
59 | ``` | ||
60 | sqrt(sin(30)) # parenstheses are mandatory for functions | ||
61 | |||
62 | log100 # no | ||
63 | log(100) # yes | ||
64 | ``` | ||
65 | |||
66 | ### quality of life features | ||
67 | |||
68 | auto insertion of `*` operator | ||
69 | ``` | ||
70 | 12sin(90) # 12 * sin(90) | ||
71 | ans: 12 | ||
72 | |||
73 | (5 + 6)(6 + 7) # (5 + 6) * (6 + 7) | ||
74 | ans: 143 | ||
75 | |||
76 | 11(12) # 11 * (12) | ||
77 | ans: 132 | ||
78 | ``` | ||
79 | |||
80 | auto balancing of parentheses | ||
81 | ``` | ||
82 | ceil(sqrt(3^2 + 5^2 | ||
83 | ans: 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~~ | ||