pull/2/head
Mark 2023-03-25 21:38:59 -07:00
parent 39c52782ca
commit b8e736af45
Signed by: Mark
GPG Key ID: AD62BB059C2AAEE4
4 changed files with 306 additions and 17 deletions

View File

@ -1,26 +1,35 @@
## For 1.0 release
![](./misc/banner.png)
A high-precision partially-symbolic calculator with support for units, derivatives, and more.
# Warning
This is nowhere near complete. Stay tuned.
# TODO
## Before For 1.0 release
- Tests
- Branding
- Replace &str with strings
- Named parameters for Tokens
- Replace strings with &str?
- Function application
- Commands
- Arrows to move cursor
## Etc
# General
- Documentation
- Versioning
## General
- CLI Options
- Compile to WASM => webapp
# Internals
## Internals
- Non-recursive treeify
- Print any expression
- Copy expression, print with result
# Features
## Features
- Variable definitions
- Function definitions
- Rational datatype
@ -29,6 +38,8 @@
- Derivatives
- MiniCAS
- Complex numbers
- Config file
- History to file
# Prompt
## Prompt
- Live syntax/output

BIN
misc/banner.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 38 KiB

279
misc/daisy.svg Normal file
View File

@ -0,0 +1,279 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
width="1200"
height="850"
viewBox="0 0 317.49998 224.89584"
version="1.1"
id="svg3246"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
sodipodi:docname="daisy.svg"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<sodipodi:namedview
id="namedview3248"
pagecolor="#9e9e9e"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="true"
inkscape:pageopacity="0"
inkscape:pagecheckerboard="true"
inkscape:deskcolor="#d1d1d1"
inkscape:document-units="px"
showgrid="false"
showborder="true"
borderlayer="false"
shape-rendering="auto"
inkscape:zoom="0.22659715"
inkscape:cx="198.59032"
inkscape:cy="22.065591"
inkscape:window-width="2560"
inkscape:window-height="1384"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="0"
inkscape:current-layer="layer1" />
<defs
id="defs3243">
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-9-6" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-0" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-9" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-0-3" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-8" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-8-9" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-8-2" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-8-2-2" />
<rect
x="567.45734"
y="347.68021"
width="408.88004"
height="160.23911"
id="rect2101-9-8-3-8-8" />
</defs>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<rect
style="fill:#0d1117;fill-opacity:1;stroke:none;stroke-width:5.40518;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
id="rect1146-6"
width="317.5"
height="105.83333"
x="0"
y="0" />
<rect
style="fill:#415472;fill-opacity:0.78596705;stroke:none;stroke-width:9.36205;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
id="rect1146-6-4"
width="952.5"
height="105.83333"
x="-93.034294"
y="-223.72656"
inkscape:export-filename="rect1146-6-4.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g6067"
inkscape:export-filename="g6067.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<g
id="g1657-2"
transform="matrix(3.3999741,0,0,3.3999741,-442.0807,494.58778)"
style="stroke:#a60d66;stroke-opacity:1">
<g
id="g2349-6-0"
style="stroke:#ea004d;stroke-opacity:1"
transform="translate(125.41922,-167.998)">
<path
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 26.115101,47.660493 c 1.853776,0.96137 4.1474,0.53544 5.680504,-1.05487 1.410359,-1.46298 1.804214,-3.05883 1.179203,-4.77799 -0.966718,-2.6591 -3.720953,-3.9058 -8.552213,-3.87115 l -1.673694,0.012 0.11351,2.11848 c 0.142919,2.66699 0.428255,4.15648 1.018046,5.31437 0.567689,1.11447 1.136825,1.68985 2.234644,2.25917 z"
id="path302-3-1-7-2-9-7-6"
sodipodi:nodetypes="sssscsss" />
<path
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 12.940109,34.959413 c -1.028597,-1.81733 -0.686937,-4.12501 0.846167,-5.71532 1.410353,-1.46298 2.990719,-1.915 4.731608,-1.35336 2.692707,0.86871 4.039427,3.57545 4.181707,8.40473 l 0.04931,1.67302 -2.121224,-0.0359 c -2.670426,-0.0452 -4.169372,-0.27577 -5.348089,-0.82278 -1.134496,-0.5265 -1.730333,-1.07418 -2.339471,-2.15042 z"
id="path302-3-1-2-0-0-8-5-8"
sodipodi:nodetypes="sssscsss" />
</g>
<g
id="g1649-9"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1">
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 144.80192,-120.3375 c -1.85377,0.96136 -4.1474,0.53544 -5.6805,-1.05487 -1.41036,-1.46298 -1.80422,-3.05883 -1.1792,-4.77799 0.96671,-2.6591 3.72095,-3.9058 8.55221,-3.87116 l 1.67369,0.012 -0.11351,2.11849 c -0.14291,2.66698 -0.42825,4.15648 -1.01805,5.31437 -0.56768,1.11446 -1.13682,1.68985 -2.23464,2.25917 z"
id="path302-3-1-7-6-6-8-3-2"
sodipodi:nodetypes="sssscsss" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 157.9769,-133.03859 c 1.0286,-1.81733 0.68693,-4.12501 -0.84616,-5.71532 -1.41036,-1.46298 -2.99072,-1.915 -4.73161,-1.35336 -2.69271,0.86871 -4.03943,3.57545 -4.18171,8.40473 l -0.0493,1.67302 2.12122,-0.0359 c 2.67043,-0.0452 4.16938,-0.27577 5.34809,-0.82278 1.1345,-0.5265 1.73033,-1.07418 2.33947,-2.15042 z"
id="path302-3-1-2-0-2-8-0-5-6"
sodipodi:nodetypes="sssscsss" />
</g>
</g>
<text
xml:space="preserve"
transform="matrix(1.2936576,0,0,1.2936576,-629.187,-444.76722)"
id="text2099-9-3-6-4"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;white-space:pre;shape-inside:url(#rect2101-9-8-3-8);display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"><tspan
x="567.45703"
y="402.89793"
id="tspan6314">Daisy</tspan></text>
</g>
<g
id="g6067-0"
inkscape:export-filename="g6067.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96"
transform="translate(224.46569,-223.72656)">
<g
id="g1657-2-3"
transform="matrix(3.3999741,0,0,3.3999741,-442.0807,494.58778)"
style="stroke:#a60d66;stroke-opacity:1">
<g
id="g2349-6-0-04"
style="stroke:#ea004d;stroke-opacity:1"
transform="translate(125.41922,-167.998)">
<path
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 26.115101,47.660493 c 1.853776,0.96137 4.1474,0.53544 5.680504,-1.05487 1.410359,-1.46298 1.804214,-3.05883 1.179203,-4.77799 -0.966718,-2.6591 -3.720953,-3.9058 -8.552213,-3.87115 l -1.673694,0.012 0.11351,2.11848 c 0.142919,2.66699 0.428255,4.15648 1.018046,5.31437 0.567689,1.11447 1.136825,1.68985 2.234644,2.25917 z"
id="path302-3-1-7-2-9-7-6-4"
sodipodi:nodetypes="sssscsss" />
<path
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 12.940109,34.959413 c -1.028597,-1.81733 -0.686937,-4.12501 0.846167,-5.71532 1.410353,-1.46298 2.990719,-1.915 4.731608,-1.35336 2.692707,0.86871 4.039427,3.57545 4.181707,8.40473 l 0.04931,1.67302 -2.121224,-0.0359 c -2.670426,-0.0452 -4.169372,-0.27577 -5.348089,-0.82278 -1.134496,-0.5265 -1.730333,-1.07418 -2.339471,-2.15042 z"
id="path302-3-1-2-0-0-8-5-8-4"
sodipodi:nodetypes="sssscsss" />
</g>
<g
id="g1649-9-4"
style="fill:none;fill-opacity:1;stroke:#000000;stroke-opacity:1">
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 144.80192,-120.3375 c -1.85377,0.96136 -4.1474,0.53544 -5.6805,-1.05487 -1.41036,-1.46298 -1.80422,-3.05883 -1.1792,-4.77799 0.96671,-2.6591 3.72095,-3.9058 8.55221,-3.87116 l 1.67369,0.012 -0.11351,2.11849 c -0.14291,2.66698 -0.42825,4.15648 -1.01805,5.31437 -0.56768,1.11446 -1.13682,1.68985 -2.23464,2.25917 z"
id="path302-3-1-7-6-6-8-3-2-7"
sodipodi:nodetypes="sssscsss" />
<path
style="fill:none;fill-opacity:1;stroke:#ffffff;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 157.9769,-133.03859 c 1.0286,-1.81733 0.68693,-4.12501 -0.84616,-5.71532 -1.41036,-1.46298 -2.99072,-1.915 -4.73161,-1.35336 -2.69271,0.86871 -4.03943,3.57545 -4.18171,8.40473 l -0.0493,1.67302 2.12122,-0.0359 c 2.67043,-0.0452 4.16938,-0.27577 5.34809,-0.82278 1.1345,-0.5265 1.73033,-1.07418 2.33947,-2.15042 z"
id="path302-3-1-2-0-2-8-0-5-6-6"
sodipodi:nodetypes="sssscsss" />
</g>
</g>
<text
xml:space="preserve"
transform="matrix(1.2936576,0,0,1.2936576,-629.187,-444.76722)"
id="text2099-9-3-6-4-3"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;white-space:pre;shape-inside:url(#rect2101-9-8-3-8-8);display:inline;fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"><tspan
x="567.45703"
y="402.89793"
id="tspan6316">Daisy</tspan></text>
</g>
<rect
style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:5.40518;stroke-linecap:round;stroke-linejoin:bevel;stroke-opacity:1"
id="rect1146-6-2"
width="317.5"
height="105.83333"
x="0"
y="119.0625"
inkscape:export-filename="rect1146-6-2.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96" />
<g
id="g6040"
inkscape:export-filename="g6040.png"
inkscape:export-xdpi="96"
inkscape:export-ydpi="96">
<g
id="g1657-2-1"
transform="matrix(3.3999741,0,0,3.3999741,-442.0807,613.65025)"
style="stroke:#a60d66;stroke-opacity:1">
<g
id="g2349-6-0-0"
style="stroke:#ea004d;stroke-opacity:1"
transform="translate(125.41922,-167.998)">
<path
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 26.115101,47.660493 c 1.853776,0.96137 4.1474,0.53544 5.680504,-1.05487 1.410359,-1.46298 1.804214,-3.05883 1.179203,-4.77799 -0.966718,-2.6591 -3.720953,-3.9058 -8.552213,-3.87115 l -1.673694,0.012 0.11351,2.11848 c 0.142919,2.66699 0.428255,4.15648 1.018046,5.31437 0.567689,1.11447 1.136825,1.68985 2.234644,2.25917 z"
id="path302-3-1-7-2-9-7-6-6"
sodipodi:nodetypes="sssscsss" />
<path
style="fill:none;fill-opacity:1;stroke:#ea004d;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 12.940109,34.959413 c -1.028597,-1.81733 -0.686937,-4.12501 0.846167,-5.71532 1.410353,-1.46298 2.990719,-1.915 4.731608,-1.35336 2.692707,0.86871 4.039427,3.57545 4.181707,8.40473 l 0.04931,1.67302 -2.121224,-0.0359 c -2.670426,-0.0452 -4.169372,-0.27577 -5.348089,-0.82278 -1.134496,-0.5265 -1.730333,-1.07418 -2.339471,-2.15042 z"
id="path302-3-1-2-0-0-8-5-8-1"
sodipodi:nodetypes="sssscsss" />
</g>
<g
id="g1649-9-5"
style="fill:none;fill-opacity:1;stroke:#111111;stroke-opacity:1">
<path
style="fill:none;fill-opacity:1;stroke:#111111;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 144.80192,-120.3375 c -1.85377,0.96136 -4.1474,0.53544 -5.6805,-1.05487 -1.41036,-1.46298 -1.80422,-3.05883 -1.1792,-4.77799 0.96671,-2.6591 3.72095,-3.9058 8.55221,-3.87116 l 1.67369,0.012 -0.11351,2.11849 c -0.14291,2.66698 -0.42825,4.15648 -1.01805,5.31437 -0.56768,1.11446 -1.13682,1.68985 -2.23464,2.25917 z"
id="path302-3-1-7-6-6-8-3-2-9"
sodipodi:nodetypes="sssscsss" />
<path
style="fill:none;fill-opacity:1;stroke:#111111;stroke-width:2.37083;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"
d="m 157.9769,-133.03859 c 1.0286,-1.81733 0.68693,-4.12501 -0.84616,-5.71532 -1.41036,-1.46298 -2.99072,-1.915 -4.73161,-1.35336 -2.69271,0.86871 -4.03943,3.57545 -4.18171,8.40473 l -0.0493,1.67302 2.12122,-0.0359 c 2.67043,-0.0452 4.16938,-0.27577 5.34809,-0.82278 1.1345,-0.5265 1.73033,-1.07418 2.33947,-2.15042 z"
id="path302-3-1-2-0-2-8-0-5-6-4"
sodipodi:nodetypes="sssscsss" />
</g>
</g>
<text
xml:space="preserve"
transform="matrix(1.2936576,0,0,1.2936576,-629.187,-325.70475)"
id="text2099-9-3-6-4-9"
style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:59.6954px;font-family:'CMU Sans Serif';-inkscape-font-specification:'CMU Sans Serif, Bold';font-variant-ligatures:no-contextual;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;white-space:pre;shape-inside:url(#rect2101-9-8-3-8-2);display:inline;fill:#000000;fill-opacity:1;stroke:none;stroke-width:15.1181;stroke-linecap:round;stroke-linejoin:bevel;stroke-dasharray:none;stroke-opacity:1"><tspan
x="567.45703"
y="402.89793"
id="tspan6318">Daisy</tspan></text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -19,12 +19,12 @@ use crate::parser::Token;
###### @@@@@@
# ##@@ @
## #@ @@
#@@@@@@@@@@@#
@@@@@@@@@@@@@
@@ @# ##
@ @@## #
@@@@@@ ######
Mariposa 0.0.1
Daisy 0.0.1
*/
#[inline(always)]
fn draw_greeter(stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io::Error> {
@ -34,12 +34,11 @@ fn draw_greeter(stdout: &mut RawTerminal<std::io::Stdout>) -> Result<(), std::io
{a} ###### {b} @@@@@@\r\n \
{a}# ##{b}@@ @\r\n \
{a}## #{b}@ @@\r\n \
{a} #{b}@@@@@@@@@@@{a}#\r\n \
{a} {b}@@@@@@@@@@@@@{a}\r\n \
{b}@@ @{a}# ##\r\n \
{b}@ @@{a}## #\r\n \
{b} @@@@@@ {a} ###### {r}\r\n \
\n \
{t}Mariposa{r} {v}0.0.1{r}\r\n\n",
\n {t}Daisy{r} {v}v0.0.0{r}\r\n\n",
a = color::Fg(color::Magenta),
b = color::Fg(color::White),
t = format!("{}{}", color::Fg(color::White), style::Bold),