Created
August 23, 2016 15:47
-
-
Save wweic/5e56c3fc47dcf3d3828b5144b6326033 to your computer and use it in GitHub Desktop.
while.ml
This file contains 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
type token = Bool of bool | |
| Number of int | |
| Identifier of string | |
| SemiColon | |
| LeftBracket | |
| RightBracket | |
| LeftParen | |
| RightParen | |
| KeywordIf | |
| KeywordThen | |
| KeywordElse | |
| KeywordWhile | |
| KeywordDo | |
| KeywordAnd | |
| KeywordOr | |
| OpAssign | |
| OpPlus | |
| OpSub | |
| OpMul | |
| OpDiv | |
| OpLT | |
| OpGT | |
type exp = PlusExp of exp * exp | |
| SubExp of exp * exp | |
| MulExp of exp * exp | |
| DivExp of exp * exp | |
| Variable of string | |
| NumLiteral of int | |
| LTExp of exp * exp | |
| GTExp of exp * exp | |
| AndExp of exp * exp | |
| OrExp of exp * exp | |
| BoolLiteral of bool | |
type prog = Stmts of prog list | |
| Assign of string * exp | |
| IfElse of exp * prog * prog | |
| While of exp * prog |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment