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