Created
October 19, 2011 22:25
-
-
Save markmarch/1299867 to your computer and use it in GitHub Desktop.
Syntax directed translation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Example of computing attributes in Rats! | |
| AssignStmt assignStmt = l : expr COLONEQ r : expr { yyValue = new AssignStmt(l, r) } | |
| // class that represents an assignment statement node. | |
| class AssignStmt extends Stmt { | |
| Expression _lhs, _rhs; // children | |
| public AssignStmt(Expression l, Expression r) { | |
| _lhs = l; | |
| _rhs = l; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment