Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9380add r24711a3  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Tue Jun 29 09:12:47 2021
    13 // Update Count     : 5027
     12// Last Modified On : Mon Apr 26 18:41:54 2021
     13// Update Count     : 4990
    1414//
    1515
     
    2626// The root language for this grammar is ANSI99/11 C. All of ANSI99/11 is parsed, except for:
    2727//
    28 //   designation with '=' (use ':' instead)
    29 //
    30 // This incompatibility is discussed in detail before the "designation" grammar rule.  Most of the syntactic extensions
    31 // from ANSI90 to ANSI11 C are marked with the comment "C99/C11".
    32 
    33 // This grammar also has two levels of extensions. The first extensions cover most of the GCC C extensions All of the
    34 // syntactic extensions for GCC C are marked with the comment "GCC". The second extensions are for Cforall (CFA), which
    35 // fixes several of C's outstanding problems and extends C with many modern language concepts. All of the syntactic
    36 // extensions for CFA C are marked with the comment "CFA".
     28// 1. designation with '=' (use ':' instead)
     29//
     30// Most of the syntactic extensions from ANSI90 to ANSI11 C are marked with the comment "C99/C11". This grammar also has
     31// two levels of extensions. The first extensions cover most of the GCC C extensions, except for:
     32//
     33// 1. designation with and without '=' (use ':' instead)
     34
     35//
     36// All of the syntactic extensions for GCC C are marked with the comment "GCC". The second extensions are for Cforall
     37// (CFA), which fixes several of C's outstanding problems and extends C with many modern language concepts. All of the
     38// syntactic extensions for CFA C are marked with the comment "CFA". As noted above, there is one unreconcileable
     39// parsing problem between C99 and CFA with respect to designators; this is discussed in detail before the "designation"
     40// grammar rule.
    3741
    3842%{
     
    265269%token INT128 UINT128 uuFLOAT80 uuFLOAT128                              // GCC
    266270%token uFLOAT16 uFLOAT32 uFLOAT32X uFLOAT64 uFLOAT64X uFLOAT128 // GCC
    267 %token DECIMAL32 DECIMAL64 DECIMAL128                                   // GCC
    268271%token ZERO_T ONE_T                                                                             // CFA
    269272%token SIZEOF TYPEOF VALIST AUTO_TYPE                                   // GCC
     
    284287
    285288// names and constants: lexer differentiates between identifier and typedef names
    286 %token<tok> IDENTIFIER          QUOTED_IDENTIFIER       TYPEDIMname             TYPEDEFname             TYPEGENname
     289%token<tok> IDENTIFIER          QUOTED_IDENTIFIER       TYPEDEFname             TYPEGENname
    287290%token<tok> TIMEOUT                     WOR                                     CATCH                   RECOVER                 CATCHRESUME             FIXUP           FINALLY         // CFA
    288291%token<tok> INTEGERconstant     CHARACTERconstant       STRINGliteral
     
    583586        | quasi_keyword
    584587                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    585         | TYPEDIMname                                                                           // CFA, generic length argument
    586                 // { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( DeclarationNode::newFromTypedef( $1 ) ) ) ); }
    587                 // { $$ = new ExpressionNode( build_varref( $1 ) ); }
    588                 { $$ = new ExpressionNode( build_dimensionref( $1 ) ); }
    589588        | tuple
    590589        | '(' comma_expression ')'
     
    631630postfix_expression:
    632631        primary_expression
    633         | postfix_expression '[' assignment_expression ',' tuple_expression_list ']'
    634                         // Historic, transitional: Disallow commas in subscripts.
    635                         // Switching to this behaviour may help check if a C compatibilty case uses comma-exprs in subscripts.
    636                 // { SemanticError( yylloc, "New array subscript is currently unimplemented." ); $$ = nullptr; }
    637                         // Current: Commas in subscripts make tuples.
    638                 { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_tuple( (ExpressionNode *)($3->set_last( $5 ) ) )) ) ); }
     632        | postfix_expression '[' assignment_expression ',' comma_expression ']'
     633                // { $$ = new ExpressionNode( build_binary_val( OperKinds::Index, $1, new ExpressionNode( build_binary_val( OperKinds::Index, $3, $5 ) ) ) ); }
     634                { SemanticError( yylloc, "New array subscript is currently unimplemented." ); $$ = nullptr; }
    639635        | postfix_expression '[' assignment_expression ']'
    640636                // CFA, comma_expression disallowed in this context because it results in a common user error: subscripting a
     
    18911887        | uFLOAT128
    18921888                { $$ = DeclarationNode::newBasicType( DeclarationNode::uFloat128 ); }
    1893         | DECIMAL32
    1894                 { SemanticError( yylloc, "_Decimal32 is currently unimplemented." ); $$ = nullptr; }
    1895         | DECIMAL64
    1896                 { SemanticError( yylloc, "_Decimal64 is currently unimplemented." ); $$ = nullptr; }
    1897         | DECIMAL128
    1898                 { SemanticError( yylloc, "_Decimal128 is currently unimplemented." ); $$ = nullptr; }
    18991889        | COMPLEX                                                                                       // C99
    19001890                { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     
    19191909        // empty
    19201910                { $$ = nullptr; }
    1921         | vtable
     1911        | vtable;
    19221912        ;
    19231913
     
    25452535        | '[' identifier_or_type_name ']'
    25462536                {
    2547                         typedefTable.addToScope( *$2, TYPEDIMname, "9" );
    2548                         $$ = DeclarationNode::newTypeParam( TypeDecl::Dimension, $2 );
     2537                        typedefTable.addToScope( *$2, TYPEDEFname, "9" );
     2538                        $$ = DeclarationNode::newTypeParam( TypeDecl::ALtype, $2 );
    25492539                }
    25502540        // | type_specifier identifier_parameter_declarator
     
    25602550        | '*'
    25612551                { $$ = TypeDecl::DStype; }                                              // dtype + sized
    2562         // | '(' '*' ')'
    2563         //      { $$ = TypeDecl::Ftype; }
    25642552        | ELLIPSIS
    25652553                { $$ = TypeDecl::Ttype; }
     
    26022590                { $$ = new ExpressionNode( new TypeExpr( maybeMoveBuildType( $1 ) ) ); }
    26032591        | assignment_expression
     2592                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $1->build()) ); $$ = nullptr; }
    26042593        | type_list ',' type
    26052594                { $$ = (ExpressionNode *)($1->set_last( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ) )); }
    26062595        | type_list ',' assignment_expression
    2607                 { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
     2596                { SemanticError( yylloc, toString("Expression generic parameters are currently unimplemented: ", $3->build()) ); $$ = nullptr; }
     2597                // { $$ = (ExpressionNode *)( $1->set_last( $3 )); }
    26082598        ;
    26092599
Note: See TracChangeset for help on using the changeset viewer.