diff --git a/src/include/parser.h b/src/include/parser.h index ef2f4ce..479ea6e 100644 --- a/src/include/parser.h +++ b/src/include/parser.h @@ -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 diff --git a/src/include/tokenize.h b/src/include/tokenize.h index 7339572..82dc7fe 100644 --- a/src/include/tokenize.h +++ b/src/include/tokenize.h @@ -7,7 +7,7 @@ #include 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;