diff --git a/README.md b/README.md index 3f72893..d54f33e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Review Assignment Due Date](https://classroom.github.com/assets/deadline-readme-button-22041afd0340ce965d47ae6ef1cefeee28c7c493a6346c4f15d667ab976d596c.svg)](https://classroom.github.com/a/4nHL7_6-) +[![Open in Visual Studio Code](https://classroom.github.com/assets/open-in-vscode-2e0aaae1b6195c2367325f4f02e2d04e9abb55f0b24a779b69b11b9e10269abc.svg)](https://classroom.github.com/online_ide?assignment_repo_id=19096205&assignment_repo_type=AssignmentRepo) # CS 164: Programming Assignment 1 [PA1 Specification]: https://drive.google.com/open?id=1oYcJ5iv7Wt8oZNS1bEfswAklbMxDtwqB diff --git a/src/main/cup/chocopy/pa1/ChocoPy.cup b/src/main/cup/chocopy/pa1/ChocoPy.cup index d4ff444..a5fac8d 100644 --- a/src/main/cup/chocopy/pa1/ChocoPy.cup +++ b/src/main/cup/chocopy/pa1/ChocoPy.cup @@ -144,6 +144,9 @@ action code {: */ terminal NEWLINE; terminal String PLUS; +terminal String MINUS; +terminal String TIMES; +terminal String DIV; terminal Integer NUMBER; /* Returned by the lexer for erroneous tokens. Since it does not appear in * the grammar, it indicates a syntax error. */ diff --git a/src/main/jflex/chocopy/pa1/ChocoPy.jflex b/src/main/jflex/chocopy/pa1/ChocoPy.jflex index 9aafe7f..73633e6 100644 --- a/src/main/jflex/chocopy/pa1/ChocoPy.jflex +++ b/src/main/jflex/chocopy/pa1/ChocoPy.jflex @@ -71,6 +71,10 @@ IntegerLiteral = 0 | [1-9][0-9]* /* Operators. */ "+" { return symbol(ChocoPyTokens.PLUS, yytext()); } + "-" { return symbol(ChocoPyTokens.MINUS, yytext()); } + "*" { return symbol(ChocoPyTokens.TIMES, yytext()); } + "/" { return symbol(ChocoPyTokens.DIV, yytext()); } + /* Whitespace. */ {WhiteSpace} { /* ignore */ }