-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add if statement #4
Conversation
} | ||
|
||
%token <int_value> BOOL_LITERAL | ||
%token <double_value> DOUBLE_LITERAL | ||
%token <int_value> INT_LITERAL | ||
%token <identifier> IDENTIFIER; | ||
%token FUNCTION IF ELSE FOR RETURN BREAK CONTINUE NIL | ||
|
||
%type <expression> expr bool_expr |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
逻辑没啥问题,就是感觉摆在一起有些突兀,应该是一般表达式,bool表达式
%token FUNCTION IF ELSE FOR RETURN BREAK CONTINUE NIL | ||
|
||
%type <expression> expr bool_expr | ||
%type <statement> stmt if_stmt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上,一般语句,if语句
%type <statement> stmt if_stmt | ||
%type <statement_list> stmt_list | ||
%type <block> block | ||
%type <elseif> elseif elseif_list | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
%nonassoc '\n' 不要了?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
之前发现会冲突,加了这个,文法改了之后没有这个问题
| if_stmt | ||
; | ||
|
||
if_stmt: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这4类if场景最好有个示意图,$有些晕
"func" return FUNCTION; | ||
"return" return RETURN; | ||
"break" return BREAK; | ||
"continue" return CONTINUE; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
漏了lock?
} | ||
|
||
%token <int_value> BOOL_LITERAL | ||
%token <double_value> DOUBLE_LITERAL | ||
%token <int_value> INT_LITERAL | ||
%token <identifier> IDENTIFIER; | ||
%token FUNCTION IF ELSE FOR RETURN BREAK CONTINUE NIL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个只是符号,在lex中实际匹配的就是"func"
No description provided.