Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Authors: Benjamin Prescott, Mark Mahan, Dillon Flohr
- //CSC 333 Assignment #2
- // Fill in the enum with variants that represent the following
- // symbols: '+', '-', '*', '/', '(', ')', ';', ',', '='
- #[derive(Debug)]
- enum Token {
- }
- // Add two fields to the following struct. One for holding
- // a vector of characters, and another that is an index (usize)
- // into the vector.
- #[derive(Debug)]
- struct Scanner {
- }
- // Implement the following methods for the Scanner struct:
- // (1) A "new" method that creates a scanner from a String
- // (2) A "get_next_token" method that returns an Option<Token>
- // representing the next symbol in the vector (or None
- // when appropriate).
- impl Scanner {
- }
- // The main function should do the following:
- // (1) Ask the user for an input file.
- // (2) Read the contents of a file into a String.
- // (3) Create a scanner object with the String.
- // (4) Use a "while let" loop to print all Tokens found in the
- // String.
- fn main() {
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement