Ignore:
Timestamp:
Feb 1, 2022, 10:10:46 AM (2 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
Children:
7b2c8c3c
Parents:
f681823 (diff), 89a5a1f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    rf681823 r376c632a  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Oct 15 09:20:17 2021
    13 // Update Count     : 5163
     12// Last Modified On : Sun Jan 30 09:41:13 2022
     13// Update Count     : 5165
    1414//
    1515
     
    238238        WaitForStmt * wfs;
    239239        Expression * constant;
    240         IfCtrl * ifctl;
     240        CondCtl * ifctl;
    241241        ForCtrl * fctl;
    242242        enum OperKinds compop;
     
    327327%type<en> comma_expression                              comma_expression_opt
    328328%type<en> argument_expression_list_opt  argument_expression_list        argument_expression                     default_initializer_opt
    329 %type<ifctl> if_control_expression
     329%type<ifctl> conditional_declaration
    330330%type<fctl> for_control_expression              for_control_expression_list
    331331%type<compop> inclexcl
     
    11231123
    11241124if_statement:
    1125         IF '(' if_control_expression ')' statement                      %prec THEN
     1125        IF '(' conditional_declaration ')' statement            %prec THEN
    11261126                // explicitly deal with the shift/reduce conflict on if/else
    11271127                { $$ = new StatementNode( build_if( $3, maybe_build_compound( $5 ), nullptr ) ); }
    1128         | IF '(' if_control_expression ')' statement ELSE statement
     1128        | IF '(' conditional_declaration ')' statement ELSE statement
    11291129                { $$ = new StatementNode( build_if( $3, maybe_build_compound( $5 ), maybe_build_compound( $7 ) ) ); }
    11301130        ;
    11311131
    1132 if_control_expression:
     1132conditional_declaration:
    11331133        comma_expression
    1134                 { $$ = new IfCtrl( nullptr, $1 ); }
     1134                { $$ = new CondCtl( nullptr, $1 ); }
    11351135        | c_declaration                                                                         // no semi-colon
    1136                 { $$ = new IfCtrl( $1, nullptr ); }
     1136                { $$ = new CondCtl( $1, nullptr ); }
    11371137        | cfa_declaration                                                                       // no semi-colon
    1138                 { $$ = new IfCtrl( $1, nullptr ); }
     1138                { $$ = new CondCtl( $1, nullptr ); }
    11391139        | declaration comma_expression                                          // semi-colon separated
    1140                 { $$ = new IfCtrl( $1, $2 ); }
     1140                { $$ = new CondCtl( $1, $2 ); }
    11411141        ;
    11421142
     
    11931193iteration_statement:
    11941194        WHILE '(' ')' statement                                                         // CFA => while ( 1 )
    1195                 { $$ = new StatementNode( build_while( new IfCtrl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); }
    1196         | WHILE '(' if_control_expression ')' statement         %prec THEN
     1195                { $$ = new StatementNode( build_while( new CondCtl( nullptr, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ), maybe_build_compound( $4 ) ) ); }
     1196        | WHILE '(' conditional_declaration ')' statement       %prec THEN
    11971197                { $$ = new StatementNode( build_while( $3, maybe_build_compound( $5 ) ) ); }
    1198         | WHILE '(' if_control_expression ')' statement ELSE statement // CFA
     1198        | WHILE '(' conditional_declaration ')' statement ELSE statement // CFA
    11991199                { SemanticError( yylloc, "Loop default block is currently unimplemented." ); $$ = nullptr; }
    12001200        | DO statement WHILE '(' ')' ';'                                        // CFA => do while( 1 )
Note: See TracChangeset for help on using the changeset viewer.