SEN-109:00040 Expression Evaluation: module / pattern-matching / generics / traits #8
Labels
No Label
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: winsdominoes/cmkl#8
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
You are given a partial starter code for a command-line interface (CLI) application in Rust. The application we will be building is an arithmetic expression evaluator. The application is essentially a simple calculator, but is implemented in a way that it extracts the input using a tokenizer, parses the expression into an abstract syntax tree, then evaluates the expression from the tree. This is similar to the way most compilers / REPL interpreters are implemented.
For example, if a user enters the following arithmetic expression on the command line:
1+2*3.2+(4/2-3/2)-2.11+2^4
The tool will print out the result 21.79.
In addition to basic arithmetic expression, our expression evaluator can also calculate bitwise AND (operator &) and bitwise OR ( operator | ) only for integer input operands. So the expression 6&4|2 will print out the result 6.0.
Your task is to complete the implementation of the given application. You may also modify the starting code to make sure that your expression evaluator works as expected. Please upload an archive of your source file for the submission.
Reference: You may also refer to the reading and example on Chapter 2: A Tour of the Rust Programming Language, Practical System Programming for Rust Developers book for detailed discussion on the design of the application. But please make sure to complete the code for this assessment by yourself!