Skip to content

yumegaaru/Ruby-Calculator-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 

Repository files navigation

README.txt

Basic Work

My calculator does all things that are described in Language note. Also, it follows the calculator grammar. I have a test file and its output

In this homework, I have three files in total 1)scan.rb scan input file and transfer it to Tokens 2)clac.rb get the tokens and do the calculation 3)hw8.txt this is a test file which contains the input that user gives and output the calculator returns

eg: input: 1+1 output: 2

Extra work

  1. Print meaningful message after assignment and clear statements.
  2. Extend the language by allowing empty lines (statements) in the input, allowing multiple statements on an input line separated by semicolons, or allowing unary minus operators
  3. I added a function called log to give the log of the expressions by using the Ruby math library.
  4. When it reads an invalid token like # or ' ', it will skip this unvalid line, print the meaningful message and continue to read next line.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages