mkhan45 / CalcuLaTeX

A pretty printing calculator language with support for units. Makes calculations easier and more presentable with real time LaTeX output, along with support for units, variables, and mathematical functions.
https://calcula.tech
Mozilla Public License 2.0
396 stars 16 forks source link

CalcuLaTeX 2.0 #87

Open mkhan45 opened 2 years ago

mkhan45 commented 2 years ago

CalcuLaTeX has potential, but it's held back by messy code and a badly designed arbitrary precision unit math system.

Arbitrary precision unit math is a pain. There are a number of libraries for it in Rust, but many of them are either made for type safe compile-time usecases, or are text based calculators.

An obvious solution is to use one of these text based calculators with a custom parser and then compile the result to LaTeX. However, an easier and less efficient solution is to use the language as an IR.

For example, with fend, we could compile CalcuLaTeX input to fend input, run fend, and then re-parse fend output and display it with LaTeX. It would probably be easier to intercept a FendResult on the output end and compile it to LaTeX. However, on the input side I believe it would be a lot easier to generate a fend input string than to actually create a Fend IR.

Using this method, a lot of CalcuLaTeX's general design might stay the same. Right now, input expressions (left side of the = ?), are basically directly translated to LaTeX, and that won't change.

mkhan45 commented 2 years ago

One major issue with this approach is vectors and matrices