You are browsing as a guest. Sign up (or log in) to start making projects!

9h 35m 21s logged

calc82: Devlog #6 18/07/2026

calc82: because calculators are for everyone

This devlog follows the further development of algebraic I/O to my calculator, including turning this into an actual result.

๐ŸŒŸ New functionality summary

  • Input and output formatting through KaTeX
  • Square root, arbitrary root, mixed fraction, and absolute values
  • Tokeniser now directly reads input tokens
  • Errors now move the cursor to the position where it occurred

๐ŸŒŠ New program flow

inputHandler -> [input tokens] -> tokeniser -> [calculator tokens] -> parser -> AST -> evaluator -> result
This:

  • improves speed (compared to parsing text)
  • allows cursor to be moved to error location since we never flatten to text
    You might notice I have two sets of tokens. They are similar, but input tokens deal with digits and combined symbols (sin(), and calculator tokens are whole numbers and separated symbols.

๐Ÿ—’๏ธ Notes

Avoiding the lazy route
My first approach was turning the input tokens into a string, which my tokeniser already knew how to deal with. However, this added much processing overhead and made it harder to find out the position at which errors occurred. Spending the time to implement the token conversion made this step much easier

Misplaced math errors
When implementing error handling, I passed down the original position of each token in the input token array down to each step of the calculation process. However, because my evaluator is recursive, it would constantly update the error position to the latest token, meaning the errors were always placed at the end. This was an easy fix in the end - but hard to spot!

๐Ÿ“ˆ Next steps

Immediate:

  • Buttons input
  • Add remaining functions (once buttons are added can be done)

Medium:

  • Multi-line calculation (Ans) and setting variables
  • Implement polar/rectangualr conversion (delayed until UI is more fleshed out)
  • Build UI

Long-term (but getting closer!):

  • Create a usable UX
  • Ship :)
0
4

Comments 0

No comments yet. Be the first!