Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/main/cup/chocopy/pa1/ChocoPy.cup
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
4 changes: 4 additions & 0 deletions src/main/jflex/chocopy/pa1/ChocoPy.jflex
Original file line number Diff line number Diff line change
Expand Up @@ -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 */ }
Expand Down