Changeset 342af53 for src/Parser


Ignore:
Timestamp:
Jan 14, 2021, 12:23:14 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
8e4aa05
Parents:
4468a70 (diff), ec19b21 (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

Location:
src/Parser
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/DeclarationNode.cc

    r4468a70 r342af53  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Oct  8 08:03:38 2020
    13 // Update Count     : 1135
     12// Last Modified On : Mon Jan 11 20:58:07 2021
     13// Update Count     : 1137
    1414//
    1515
     
    10751075        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
    10761076                // otype is internally converted to dtype + otype parameters
    1077                 static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype };
    1078                 static_assert( sizeof(kindMap)/sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
     1077                static const TypeDecl::Kind kindMap[] = { TypeDecl::Dtype, TypeDecl::DStype, TypeDecl::Dtype, TypeDecl::Ftype, TypeDecl::Ttype, TypeDecl::ALtype };
     1078                static_assert( sizeof(kindMap) / sizeof(kindMap[0]) == TypeDecl::NUMBER_OF_KINDS, "DeclarationNode::build: kindMap is out of sync." );
    10791079                assertf( variable.tyClass < sizeof(kindMap)/sizeof(kindMap[0]), "Variable's tyClass is out of bounds." );
    10801080                TypeDecl * ret = new TypeDecl( *name, Type::StorageClasses(), nullptr, kindMap[ variable.tyClass ], variable.tyClass == TypeDecl::Otype, variable.initializer ? variable.initializer->buildType() : nullptr );
  • src/Parser/ParseNode.h

    r4468a70 r342af53  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct 24 03:53:54 2020
    13 // Update Count     : 895
     12// Last Modified On : Sun Jan  3 18:23:01 2021
     13// Update Count     : 896
    1414//
    1515
     
    3939struct DeclarationNode;
    4040class DeclarationWithType;
     41class Initializer;
    4142class ExpressionNode;
    42 class Initializer;
    4343struct StatementNode;
    4444
  • src/Parser/parser.yy

    r4468a70 r342af53  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct 24 08:21:14 2020
    13 // Update Count     : 4624
     12// Last Modified On : Mon Jan 11 21:32:10 2021
     13// Update Count     : 4633
    1414//
    1515
     
    329329%type<en> conditional_expression                constant_expression                     assignment_expression           assignment_expression_opt
    330330%type<en> comma_expression                              comma_expression_opt
    331 %type<en> argument_expression_list_opt  argument_expression                     default_initialize_opt
     331%type<en> argument_expression_list_opt  argument_expression                     default_initializer_opt
    332332%type<ifctl> if_control_expression
    333333%type<fctl> for_control_expression              for_control_expression_list
     
    424424%type<decl> sue_declaration_specifier sue_declaration_specifier_nobody sue_type_specifier sue_type_specifier_nobody
    425425
    426 %type<tclass> type_class
     426%type<tclass> type_class new_type_class
    427427%type<decl> type_declarator type_declarator_name type_declaring_list
    428428
     
    15451545        | cfa_function_declaration
    15461546        | type_declaring_list
     1547                { SemanticError( yylloc, "otype declaration is currently unimplemented." ); $$ = nullptr; }
    15471548        | trait_specifier
    15481549        ;
     
    22232224        ;
    22242225
    2225 cfa_parameter_ellipsis_list_opt:                                                        // CFA, abstract + real
     2226cfa_parameter_ellipsis_list_opt:                                                // CFA, abstract + real
    22262227        // empty
    22272228                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     
    22802281cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    22812282        parameter_declaration
    2282         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
     2283        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initializer_opt
    22832284                { $$ = $1->addName( $2 ); }
    2284         | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     2285        | cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    22852286                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    22862287                { $$ = $1->addName( $2 ); }
    2287         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     2288        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    22882289                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    22892290        | cfa_function_specifier
     
    23022303parameter_declaration:
    23032304                // No SUE declaration in parameter list.
    2304         declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
     2305        declaration_specifier_nobody identifier_parameter_declarator default_initializer_opt
    23052306                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    2306         | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
     2307        | declaration_specifier_nobody type_parameter_redeclarator default_initializer_opt
    23072308                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    23082309        ;
    23092310
    23102311abstract_parameter_declaration:
    2311         declaration_specifier_nobody default_initialize_opt
     2312        declaration_specifier_nobody default_initializer_opt
    23122313                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    2313         | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
     2314        | declaration_specifier_nobody abstract_parameter_declarator default_initializer_opt
    23142315                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    23152316        ;
     
    24412442        type_class identifier_or_type_name
    24422443                { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); }
    2443         type_initializer_opt assertion_list_opt
     2444          type_initializer_opt assertion_list_opt
    24442445                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    2445         | type_specifier identifier_parameter_declarator
     2446        | identifier_or_type_name new_type_class
     2447                { typedefTable.addToScope( *$1, TYPEDEFname, "9" ); }
     2448          type_initializer_opt assertion_list_opt
     2449                { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
     2450        | '[' identifier_or_type_name ']'
     2451                {
     2452                        typedefTable.addToScope( *$2, TYPEDEFname, "9" );
     2453                        $$ = DeclarationNode::newTypeParam( TypeDecl::ALtype, $2 );
     2454                }
     2455        // | type_specifier identifier_parameter_declarator
    24462456        | assertion_list
    24472457                { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
     2458        ;
     2459
     2460new_type_class:                                                                                 // CFA
     2461        // empty
     2462                { $$ = TypeDecl::Otype; }
     2463        | '&'
     2464                { $$ = TypeDecl::Dtype; }
     2465        | '*'
     2466                { $$ = TypeDecl::DStype; }                                              // dtype + sized
     2467        | ELLIPSIS
     2468                { $$ = TypeDecl::Ttype; }
    24482469        ;
    24492470
     
    34763497        ;
    34773498
    3478 default_initialize_opt:
     3499default_initializer_opt:
    34793500        // empty
    34803501                { $$ = nullptr; }
Note: See TracChangeset for help on using the changeset viewer.