Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create algebraic expression parsing algorithm #71

Closed
3 tasks
tovaio opened this issue Oct 27, 2021 · 2 comments
Closed
3 tasks

Create algebraic expression parsing algorithm #71

tovaio opened this issue Oct 27, 2021 · 2 comments
Assignees
Labels
frontend wontfix This will not be worked on

Comments

@tovaio
Copy link
Collaborator

tovaio commented Oct 27, 2021

Description

As students, we want Jebra to be able to convert our string input answers into a format it can understand and compare easily, so that we don't have to worry about string formatting issues when typing our answers (e.g. spaces between terms/operators, unnecessary decimal points, etc.).

As developers, we want to develop an algorithm that parses strings containing expressions into a syntax tree, so we can use it to compare students' string answers to our stored correct string answers regardless of differences in format.

Example

Correct answer in database: "25"
Student input: "25.0"

Correct answer in database: "3a + 2b"
Student input: "3a+2b" or "3*a + 2*b" or similar

These answers are correct, but they aren't the same strings. We want an algorithm that parses these strings into some sort of syntax tree and compares these trees.

For example:

  • "25" --> num(25)
  • "3a + 2b" --> add(mul(num(3), var(a)), mul(num(2), var(b)))

Acceptance Criteria

  • Lexing: algorithm reads through input string and splits it into array of tokens
  • Parsing: algorithm reads through array of tokens and creates a syntax tree
  • Equality: syntax trees can be compared, with commutativity taken into account (e.g. 25 + a == a + 25 or 3a == a*3)
@tovaio tovaio created this issue from a note in Jebra-IPRO (To do) Oct 27, 2021
@tovaio tovaio self-assigned this Oct 27, 2021
@tovaio
Copy link
Collaborator Author

tovaio commented Oct 27, 2021

Note: we can use this package to assist us for this task

@tovaio tovaio added the wontfix This will not be worked on label Feb 1, 2022
@tovaio tovaio closed this as completed Feb 1, 2022
@tovaio tovaio removed this from To do in Jebra-IPRO Feb 1, 2022
@tovaio
Copy link
Collaborator Author

tovaio commented Feb 2, 2022

Closed since there are likely publicly available packages that address this need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

1 participant