Skip to content

qingbol/topl_prjct4

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Name:Qingbo Lai

Course no: CpSc 8270

Clemson Email Address: [email protected] 

Project no:4

Project due date: 8AM, Friday, Nov 16, 2018

Project description:
*Design and implement AST to interpret some python code
*Finished integer,float,string types.
*Implemented basic arithmetic operation of values and variables and expressions 
such as: {x + y, x − y, x ∗ y, x/y, x//y, x%y, x**e, (x), −x, +x}.
*Implemented the following additional forms of assignment:
{ x+ = y, x− = y, x∗ = y, x/ = y, x// = y, x% = y }.
*Implemented string slicing.
Use static_cast<const IntLiteral*>($1->eval())->get_val() to get the index value.
Use static_cast<const StringLiteral*>($1->eval())->get_val() to get the string value.
Then use substr function to implement the slicing in c++.
*I designed and passed 349 test cases including the above operation.

The easiest part of this project:
* Implement the plus and multiply operation in  int and float type 

Problems that I had in completing this project:
*It took me a lot time to figure out how to implement the string slicing.
* The grammar in parse.y is too complecated to totally understand.


About

Repo for TOPL course project4

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors