GraphiteEditor / Graphite

2D vector & raster editor that melds traditional layers & tools with a modern node-based, non-destructive, procedural workflow.
https://graphite.rs
Apache License 2.0
9.76k stars 473 forks source link

Fully-featured math expression parser and calculator #2026

Closed Keavon closed 1 week ago

Keavon commented 1 month ago

This should be built as a library (in our /libraries directory) that uses a parsing framework such as nom or pest that takes a string at runtime and calculates its result, including units and dimensional analysis.

This would make a great solo contribution for somebody interested in developing a robust solution for this problem without needing to learn any of Graphite's code base. It would also make a good university team/solo "capstone" project, which our organization can serve as an "industry sponsor" for.

Here's the spec:

Operators

Constants

Variables

Functions

Number representations

Units

Unit list

Unit metric prefixes

Implicit multiplication

API features

abueno19 commented 1 month ago

I'm interested in this issue. I'm a bit new, but I hope to do my best and make progress in this field.

Keavon commented 1 month ago

@abueno19 that would be great, thanks for volunteering! We'd ideally like to get a reasonably functional version of this working in the next month or so, with progress towards the full functionality outlined here over the next couple months. My plan was to post this issue on /r/rust to find interested collaborators. Multiple people could probably work on it together, like writing tests, figuring out the correct formal grammar, handling the AST, working with the dimensional analysis, calculating the values, implementing the functions, etc. What's your level of experience with software engineering or computer science in general, and grammar parsing in particular, and would you like to work with others on this?

abueno19 commented 1 month ago

@Keavon

Hello,
I have 2 years of experience working with IoT in .NET, and I’ve been working with Rust for 3 months on my own mini-projects.

As for grammar analysis, I don’t think I’d have any issues with parsing.

Regarding your question about working with others, I would love to!

What I’m looking to gain from this is learning how to structure code, work in a community, and learn new methodologies.

Just let me know, and I’ll start with the basics (character parsing system).
By the way, how will the data be passed around?

urisinger commented 1 month ago

This issue seems interesting, I'm working on a parser for desmos expressions and the syntax is very similar, so maybe some of the code can be reused.

Keavon commented 1 month ago

Thanks for the introduction, @abueno19! Could you join our Discord (https://discord.graphite.rs) and work with @urisinger in the new channel I created for this library project, which I've tentatively called #🧮math-expr-calc? Easier to communicate there by chatting compared to here. See you there!