mirror of
https://github.com/captn3m0/nand2tetris.git
synced 2024-09-08 07:46:26 +00:00
Adds grammar for Statements
This commit is contained in:
parent
937db42830
commit
9e40244023
@ -322,3 +322,50 @@ subRoutineName
|
||||
#### `className`, `subroutineName`, `varName`
|
||||
|
||||
`identifier`
|
||||
|
||||
### Statements
|
||||
|
||||
#### `statements`
|
||||
|
||||
`statement*`
|
||||
|
||||
#### `statement`
|
||||
|
||||
`letStatement | ifStatement | whileStatement | doStatement | returnStatement`
|
||||
|
||||
#### `letStatement`
|
||||
|
||||
`let varName ([ expression])? = expression ;`
|
||||
|
||||
#### `ifStatement`
|
||||
|
||||
```
|
||||
if (expression) { statements }
|
||||
(else {statements})?
|
||||
```
|
||||
|
||||
#### `whileStatement`
|
||||
|
||||
`while (expression) {statements}`
|
||||
|
||||
#### `doStatement`
|
||||
|
||||
`do subroutineCall;`
|
||||
|
||||
#### `returnStatement`
|
||||
|
||||
`return expression?`;
|
||||
|
||||
### Expressions
|
||||
|
||||
TODO
|
||||
|
||||
### Terminal / Non-Terminal Keywords
|
||||
|
||||
|Terminal|Non-Terminal|
|
||||
|--------|------------|
|
||||
|keyword,symbol,integerConstant,stringConstant,identifier|class,classVarDec,subroutineDec,parameterList,subroutineBody,varDec|
|
||||
||statements,whileStatement,ifStatement,returnStatement,letStatement,doStatement|
|
||||
||expression,term,expressionList|
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user