From e0ea22c1d187daca55625bafe04efc3dd9bd6af2 Mon Sep 17 00:00:00 2001 From: Lai-YT <381xvmvbib@gmail.com> Date: Thu, 14 Sep 2023 21:34:42 +0800 Subject: [PATCH] Add comment of ISO C99 section number --- parser.y | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/parser.y b/parser.y index c7f9e2d3..bad5f7d2 100644 --- a/parser.y +++ b/parser.y @@ -107,18 +107,22 @@ stmt: ';' { $$ = std::make_unique(); } expr: ID { $$ = std::make_unique($1); } | NUM { $$ = std::make_unique($1); } + /* additive 6.5.6 */ | expr '+' expr { $$ = std::make_unique($1, $3); } | expr '-' expr { $$ = std::make_unique($1, $3); } + /* multiplicative 6.5.5 */ | expr '*' expr { $$ = std::make_unique($1, $3); } | expr '/' expr { $$ = std::make_unique($1, $3); } + /* relational 6.5.8 */ | expr '>' expr { $$ = std::make_unique($1, $3); } | expr '<' expr { $$ = std::make_unique($1, $3); } | expr GE expr { $$ = std::make_unique($1, $3); } | expr LE expr { $$ = std::make_unique($1, $3); } + /* equality 6.5.9 */ | expr EQ expr { $$ = std::make_unique($1, $3); } | expr NE expr { $$ = std::make_unique($1, $3); } | '(' expr ')' { $$ = $2; } - /* assignment operators */ + /* assignment 6.5.16 */ | ID '=' expr { $$ = std::make_unique($1, $3); } ;