Changeset 5a51798 for src


Ignore:
Timestamp:
Jan 10, 2021, 5:47:10 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
64aeca0
Parents:
a6e5091
Message:

add new parsing syntax to eventually replace Xtype

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    ra6e5091 r5a51798  
    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 : Sun Jan 10 17:41:00 2021
     13// Update Count     : 4625
    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
     
    22232223        ;
    22242224
    2225 cfa_parameter_ellipsis_list_opt:                                                        // CFA, abstract + real
     2225cfa_parameter_ellipsis_list_opt:                                                // CFA, abstract + real
    22262226        // empty
    22272227                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     
    22802280cfa_parameter_declaration:                                                              // CFA, new & old style parameter declaration
    22812281        parameter_declaration
    2282         | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initialize_opt
     2282        | cfa_identifier_parameter_declarator_no_tuple identifier_or_type_name default_initializer_opt
    22832283                { $$ = $1->addName( $2 ); }
    2284         | cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     2284        | cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    22852285                // To obtain LR(1), these rules must be duplicated here (see cfa_abstract_declarator).
    22862286                { $$ = $1->addName( $2 ); }
    2287         | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initialize_opt
     2287        | type_qualifier_list cfa_abstract_tuple identifier_or_type_name default_initializer_opt
    22882288                { $$ = $2->addName( $3 )->addQualifiers( $1 ); }
    22892289        | cfa_function_specifier
     
    23022302parameter_declaration:
    23032303                // No SUE declaration in parameter list.
    2304         declaration_specifier_nobody identifier_parameter_declarator default_initialize_opt
     2304        declaration_specifier_nobody identifier_parameter_declarator default_initializer_opt
    23052305                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    2306         | declaration_specifier_nobody type_parameter_redeclarator default_initialize_opt
     2306        | declaration_specifier_nobody type_parameter_redeclarator default_initializer_opt
    23072307                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    23082308        ;
    23092309
    23102310abstract_parameter_declaration:
    2311         declaration_specifier_nobody default_initialize_opt
     2311        declaration_specifier_nobody default_initializer_opt
    23122312                { $$ = $1->addInitializer( $2 ? new InitializerNode( $2 ) : nullptr ); }
    2313         | declaration_specifier_nobody abstract_parameter_declarator default_initialize_opt
     2313        | declaration_specifier_nobody abstract_parameter_declarator default_initializer_opt
    23142314                { $$ = $2->addType( $1 )->addInitializer( $3 ? new InitializerNode( $3 ) : nullptr ); }
    23152315        ;
     
    24412441        type_class identifier_or_type_name
    24422442                { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); }
    2443         type_initializer_opt assertion_list_opt
     2443          type_initializer_opt assertion_list_opt
    24442444                { $$ = DeclarationNode::newTypeParam( $1, $2 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
    2445         | type_specifier identifier_parameter_declarator
     2445        | identifier_or_type_name new_type_class
     2446                { typedefTable.addToScope( *$1, TYPEDEFname, "9" ); }
     2447          type_initializer_opt assertion_list_opt
     2448                { $$ = DeclarationNode::newTypeParam( $2, $1 )->addTypeInitializer( $4 )->addAssertions( $5 ); }
     2449        | '[' identifier_or_type_name ']'
     2450                { typedefTable.addToScope( *$2, TYPEDEFname, "9" ); }
     2451        // | type_specifier identifier_parameter_declarator
    24462452        | assertion_list
    24472453                { $$ = DeclarationNode::newTypeParam( TypeDecl::Dtype, new string( DeclarationNode::anonymous.newName() ) )->addAssertions( $1 ); }
     2454        ;
     2455
     2456new_type_class:                                                                                 // CFA
     2457        // empty
     2458                { $$ = TypeDecl::Otype; }
     2459        | '&'
     2460                { $$ = TypeDecl::Dtype; }
     2461        | '*'
     2462                { $$ = TypeDecl::Dtype; }
     2463        | ELLIPSIS
     2464                { $$ = TypeDecl::Ttype; }
    24482465        ;
    24492466
     
    34763493        ;
    34773494
    3478 default_initialize_opt:
     3495default_initializer_opt:
    34793496        // empty
    34803497                { $$ = nullptr; }
Note: See TracChangeset for help on using the changeset viewer.