Ignore:
Timestamp:
Nov 13, 2023, 3:43:43 AM (23 months ago)
Author:
JiadaL <j82liang@…>
Branches:
master
Children:
25f2798
Parents:
0030b508 (diff), 2174191 (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

    r0030b508 rfc12f05  
    4848using namespace std;
    4949
    50 #include "SynTree/Type.h"                               // for Type
    5150#include "DeclarationNode.h"                            // for DeclarationNode, ...
    5251#include "ExpressionNode.h"                             // for ExpressionNode, ...
     
    5857#include "Common/SemanticError.h"                                               // error_str
    5958#include "Common/utility.h"                                                             // for maybeMoveBuild, maybeBuild, CodeLo...
    60 
    61 #include "SynTree/Attribute.h"                                                  // for Attribute
    6259
    6360// lex uses __null in a boolean context, it's fine.
     
    17261723cofor_statement:
    17271724        COFOR '(' for_control_expression_list ')' statement
    1728                 { SemanticError( yylloc, "cofor statement is currently unimplemented." ); $$ = nullptr; }
     1725                { $$ = new StatementNode( build_cofor( yylloc, $3, maybe_build_compound( yylloc, $5 ) ) ); }
    17291726        ;
    17301727
     
    21692166type_qualifier_name:
    21702167        CONST
    2171                 { $$ = DeclarationNode::newTypeQualifier( Type::Const ); }
     2168                { $$ = DeclarationNode::newTypeQualifier( ast::CV::Const ); }
    21722169        | RESTRICT
    2173                 { $$ = DeclarationNode::newTypeQualifier( Type::Restrict ); }
     2170                { $$ = DeclarationNode::newTypeQualifier( ast::CV::Restrict ); }
    21742171        | VOLATILE
    2175                 { $$ = DeclarationNode::newTypeQualifier( Type::Volatile ); }
     2172                { $$ = DeclarationNode::newTypeQualifier( ast::CV::Volatile ); }
    21762173        | ATOMIC
    2177                 { $$ = DeclarationNode::newTypeQualifier( Type::Atomic ); }
     2174                { $$ = DeclarationNode::newTypeQualifier( ast::CV::Atomic ); }
    21782175        | forall
    21792176                { $$ = DeclarationNode::newForall( $1 ); }
     
    22062203storage_class:
    22072204        EXTERN
    2208                 { $$ = DeclarationNode::newStorageClass( Type::Extern ); }
     2205                { $$ = DeclarationNode::newStorageClass( ast::Storage::Extern ); }
    22092206        | STATIC
    2210                 { $$ = DeclarationNode::newStorageClass( Type::Static ); }
     2207                { $$ = DeclarationNode::newStorageClass( ast::Storage::Static ); }
    22112208        | AUTO
    2212                 { $$ = DeclarationNode::newStorageClass( Type::Auto ); }
     2209                { $$ = DeclarationNode::newStorageClass( ast::Storage::Auto ); }
    22132210        | REGISTER
    2214                 { $$ = DeclarationNode::newStorageClass( Type::Register ); }
     2211                { $$ = DeclarationNode::newStorageClass( ast::Storage::Register ); }
    22152212        | THREADLOCALGCC                                                                                // GCC
    2216                 { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalGcc ); }
     2213                { $$ = DeclarationNode::newStorageClass( ast::Storage::ThreadLocalGcc ); }
    22172214        | THREADLOCALC11                                                                                // C11
    2218                 { $$ = DeclarationNode::newStorageClass( Type::ThreadlocalC11 ); }
     2215                { $$ = DeclarationNode::newStorageClass( ast::Storage::ThreadLocalC11 ); }
    22192216                // Put function specifiers here to simplify parsing rules, but separate them semantically.
    22202217        | INLINE                                                                                        // C99
    2221                 { $$ = DeclarationNode::newFuncSpecifier( Type::Inline ); }
     2218                { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Inline ); }
    22222219        | FORTRAN                                                                                       // C99
    2223                 { $$ = DeclarationNode::newFuncSpecifier( Type::Fortran ); }
     2220                { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Fortran ); }
    22242221        | NORETURN                                                                                      // C11
    2225                 { $$ = DeclarationNode::newFuncSpecifier( Type::Noreturn ); }
     2222                { $$ = DeclarationNode::newFuncSpecifier( ast::Function::Noreturn ); }
    22262223        ;
    22272224
     
    37173714                { $$ = $1->addQualifiers( $2 ); }
    37183715        | '&' MUTEX paren_identifier attribute_list_opt
    3719                 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }
     3716                { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }
    37203717        | identifier_parameter_ptr
    37213718        | identifier_parameter_array attribute_list_opt
     
    37673764                { $$ = $1->addQualifiers( $2 ); }
    37683765        | '&' MUTEX typedef_name attribute_list_opt
    3769                 { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }
     3766                { $$ = $3->addPointer( DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf ) )->addQualifiers( $4 ); }
    37703767        | type_parameter_ptr
    37713768        | type_parameter_array attribute_list_opt
     
    39413938        abstract_parameter_ptr
    39423939        | '&' MUTEX attribute_list_opt
    3943                 { $$ = DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( Type::Mutex ), OperKinds::AddressOf )->addQualifiers( $3 ); }
     3940                { $$ = DeclarationNode::newPointer( DeclarationNode::newTypeQualifier( ast::CV::Mutex ), OperKinds::AddressOf )->addQualifiers( $3 ); }
    39443941        | abstract_parameter_array attribute_list_opt
    39453942                { $$ = $1->addQualifiers( $2 ); }
Note: See TracChangeset for help on using the changeset viewer.