Conditional statements grammar
This commit is contained in:
parent
1a37e67b2c
commit
5e304a70aa
@ -12,7 +12,9 @@ Prog -> Instruction Prog | Instruction
|
||||
|
||||
Instruction -> Statement | ExprStatement; | Expr; | ;
|
||||
|
||||
Statement -> // Rien pour l'instant, mais "for", "if" etc
|
||||
Statement ->
|
||||
| { Prog }
|
||||
| If (Expr) Instruction Else Instruction
|
||||
ExprStatement ->
|
||||
| Type ParIdentifier = Expr // AssignedDeclaration
|
||||
| Type ParIdentifier // Declaration
|
||||
|
@ -7,7 +7,7 @@
|
||||
#include <stdexcept>
|
||||
using namespace std;
|
||||
|
||||
enum class TokenType { Type, Identifier, Int, Plus, Minus, DoublePlus, DoubleMinus, Star, Slash, Percent, Equal, Semicolon, LParenthese, RParenthese };
|
||||
enum class TokenType { Type, Identifier, Int, Plus, Minus, DoublePlus, DoubleMinus, Star, Slash, Percent, Equal, Semicolon, LParenthese, RParenthese, LCurlyBracket, RCurlyBracket, If, Else };
|
||||
enum class Type { Int };
|
||||
|
||||
using TokenData = variant<int, string, Type>;
|
||||
|
Loading…
Reference in New Issue
Block a user