Changeset ec55ed5 for src/Parser


Ignore:
Timestamp:
Aug 23, 2017, 5:19:01 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
9ef4dcc
Parents:
9aaac6e9 (diff), 66b8773 (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:/u/cforall/software/cfa/cfa-cc

Location:
src/Parser
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/lex.ll

    r9aaac6e9 rec55ed5  
    1010 * Created On       : Sat Sep 22 08:58:10 2001
    1111 * Last Modified By : Peter A. Buhr
    12  * Last Modified On : Thu Jul 27 21:46:06 2017
    13  * Update Count     : 550
     12 * Last Modified On : Tue Aug 22 22:43:39 2017
     13 * Update Count     : 558
    1414 */
    1515
     
    4545#define NUMERIC_RETURN(x)       rm_underscore(); RETURN_VAL( x ) // numeric constant
    4646#define KEYWORD_RETURN(x)       RETURN_CHAR( x )                        // keyword
     47#define QKEYWORD_RETURN(x)      typedefTable.isKind( yytext ); RETURN_VAL(x); // quasi-keyword
    4748#define IDENTIFIER_RETURN()     RETURN_VAL( typedefTable.isKind( yytext ) )
    4849#define ATTRIBUTE_RETURN()      RETURN_VAL( ATTR_IDENTIFIER )
     
    260261throw                   { KEYWORD_RETURN(THROW); }                              // CFA
    261262throwResume             { KEYWORD_RETURN(THROWRESUME); }                // CFA
     263timeout                 { QKEYWORD_RETURN(TIMEOUT); }                   // CFA
    262264trait                   { KEYWORD_RETURN(TRAIT); }                              // CFA
    263265try                             { KEYWORD_RETURN(TRY); }                                // CFA
     
    276278__volatile              { KEYWORD_RETURN(VOLATILE); }                   // GCC
    277279__volatile__    { KEYWORD_RETURN(VOLATILE); }                   // GCC
     280waitfor                 { KEYWORD_RETURN(WAITFOR); }
     281or                              { QKEYWORD_RETURN(WOR); }                               // CFA
     282when                    { KEYWORD_RETURN(WHEN); }
    278283while                   { KEYWORD_RETURN(WHILE); }
    279284with                    { KEYWORD_RETURN(WITH); }                               // CFA
  • src/Parser/parser.yy

    r9aaac6e9 rec55ed5  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Aug 20 09:21:54 2017
    13 // Update Count     : 2573
     12// Last Modified On : Wed Aug 23 14:53:20 2017
     13// Update Count     : 2702
    1414//
    1515
     
    131131%token ATTRIBUTE EXTENSION                                                              // GCC
    132132%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
    133 %token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH // CFA
     133%token CHOOSE DISABLE ENABLE FALLTHRU TRY CATCH CATCHRESUME FINALLY THROW THROWRESUME AT WITH WHEN WAITFOR // CFA
    134134%token ASM                                                                                              // C99, extension ISO/IEC 9899:1999 Section J.5.10(1)
    135135%token ALIGNAS ALIGNOF GENERIC STATICASSERT                             // C11
     
    137137// names and constants: lexer differentiates between identifier and typedef names
    138138%token<tok> IDENTIFIER                  QUOTED_IDENTIFIER               TYPEDEFname                             TYPEGENname
     139%token<tok> TIMEOUT                             WOR
    139140%token<tok> ATTR_IDENTIFIER             ATTR_TYPEDEFname                ATTR_TYPEGENname
    140141%token<tok> INTEGERconstant             CHARACTERconstant               STRINGliteral
     
    161162%type<tok> identifier  no_attr_identifier
    162163%type<tok> identifier_or_type_name  no_attr_identifier_or_type_name  attr_name
     164%type<tok> quasi_keyword
    163165%type<constant> string_literal
    164166%type<str> string_literal_list
     
    190192%type<sn> iteration_statement                   jump_statement
    191193%type<sn> with_statement                                exception_statement                     asm_statement
     194%type<sn> when_clause_opt                               waitfor_statement                       waitfor_clause                          waitfor                         timeout
    192195%type<sn> fall_through_opt                              fall_through
    193196%type<sn> statement                                             statement_list
     
    197200%type<sn> case_clause                                   case_value_list                         case_label                                      case_label_list
    198201%type<sn> switch_clause_list_opt                switch_clause_list                      choose_clause_list_opt          choose_clause_list
    199 %type<sn> /* handler_list */                    handler_clause                          finally_clause
     202%type<sn> handler_clause                                finally_clause
    200203%type<catch_kind> handler_key
    201204
     
    295298// Handle single shift/reduce conflict for dangling else by shifting the ELSE token. For example, this string
    296299// is ambiguous:
    297 // .---------.                          matches IF '(' comma_expression ')' statement
     300// .---------.                          matches IF '(' comma_expression ')' statement . (reduce)
    298301// if ( C ) S1 else S2
    299 // `-----------------'          matches IF '(' comma_expression ')' statement ELSE statement */
    300 
    301 %nonassoc THEN  // rule precedence for IF '(' comma_expression ')' statement
    302 %nonassoc ELSE  // token precedence for start of else clause in IF statement
     302// `-----------------'          matches IF '(' comma_expression ')' statement . (shift) ELSE statement */
     303// Similar issues exit with the waitfor statement.
     304
     305// Order of these lines matters. THEN is left associative over WOR/TIMEOUT/ELSE, WOR is left associative over
     306// TIMEOUT/ELSE, and TIMEOUT is left associative over ELSE.
     307%precedence THEN        // rule precedence for IF/WAITFOR statement
     308%precedence WOR         // token precedence for start of WOR in WAITFOR statement
     309%precedence TIMEOUT     // token precedence for start of TIMEOUT in WAITFOR statement
     310%precedence ELSE        // token precedence for start of else clause in IF/WAITFOR statement
    303311
    304312%start translation_unit                                                                 // parse-tree root
     
    353361        ;
    354362
     363quasi_keyword:                                                                                  // CFA
     364        TIMEOUT
     365        | WOR
     366        ;
     367
    355368identifier:
    356369        IDENTIFIER
    357370        | ATTR_IDENTIFIER                                                                       // CFA
     371        | quasi_keyword
    358372        ;
    359373
    360374no_attr_identifier:
    361375        IDENTIFIER
     376        | quasi_keyword
    362377        ;
    363378
     
    380395primary_expression:
    381396        IDENTIFIER                                                                                      // typedef name cannot be used as a variable name
     397                { $$ = new ExpressionNode( build_varref( $1 ) ); }
     398        | quasi_keyword
    382399                { $$ = new ExpressionNode( build_varref( $1 ) ); }
    383400        | tuple
     
    736753        | jump_statement
    737754        | with_statement
     755        | waitfor_statement
    738756        | exception_statement
    739757        | asm_statement
     
    955973
    956974with_statement:
    957         WITH '(' tuple_expression_list ')' compound_statement
    958                 { $$ = (StatementNode *)0; }                                    // FIX ME
     975        WITH '(' tuple_expression_list ')' statement
     976                { $$ = nullptr; }                                                               // FIX ME
     977        ;
     978
     979when_clause_opt:
     980        // empty
     981                { $$ = nullptr; }                                                               // FIX ME
     982        | WHEN '(' comma_expression ')'
     983                { $$ = nullptr; }                                                               // FIX ME
     984        ;
     985
     986waitfor:
     987        WAITFOR '(' identifier ')'
     988                { $$ = nullptr; }                                                               // FIX ME
     989        | WAITFOR '(' identifier ',' argument_expression_list ')'
     990                { $$ = nullptr; }                                                               // FIX ME
     991        ;
     992
     993timeout:
     994        TIMEOUT '(' comma_expression ')'
     995                { $$ = nullptr; }                                                               // FIX ME
     996        ;
     997
     998waitfor_clause:
     999        when_clause_opt waitfor statement %prec THEN
     1000                { $$ = nullptr; }                                                               // FIX ME
     1001        | when_clause_opt waitfor statement WOR waitfor_clause
     1002                { $$ = nullptr; }                                                               // FIX ME
     1003        | when_clause_opt timeout statement %prec THEN
     1004                { $$ = nullptr; }                                                               // FIX ME
     1005        | when_clause_opt ELSE statement
     1006                { $$ = nullptr; }                                                               // FIX ME
     1007        | when_clause_opt timeout statement WOR when_clause_opt ELSE statement
     1008                { $$ = nullptr; }                                                               // FIX ME
     1009        ;
     1010
     1011waitfor_statement:
     1012        when_clause_opt waitfor statement %prec THEN
     1013                { $$ = nullptr; }                                                               // FIX ME
     1014        | when_clause_opt waitfor statement WOR waitfor_clause
     1015                { $$ = nullptr; }                                                               // FIX ME
    9591016        ;
    9601017
     
    9671024                { $$ = new StatementNode( build_try( $2, $3, $4 ) ); }
    9681025        ;
    969 
    970 //handler_list:
    971 //      handler_clause
    972 //              // ISO/IEC 9899:1999 Section 15.3(6 ) If present, a "..." handler shall be the last handler for its try block.
    973 //      | CATCH '(' ELLIPSIS ')' compound_statement
    974 //              { $$ = new StatementNode( build_catch( 0, $5, true ) ); }
    975 //      | handler_clause CATCH '(' ELLIPSIS ')' compound_statement
    976 //              { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }
    977 //      | CATCHRESUME '(' ELLIPSIS ')' compound_statement
    978 //              { $$ = new StatementNode( build_catch( 0, $5, true ) ); }
    979 //      | handler_clause CATCHRESUME '(' ELLIPSIS ')' compound_statement
    980 //              { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( 0, $6, true ) ) ); }
    981 //      ;
    9821026
    9831027handler_clause:
     
    22392283with_clause_opt:
    22402284        // empty
    2241                 { $$ = (StatementNode *)0; }                                    // FIX ME
     2285                { $$ = nullptr; }                                                               // FIX ME
    22422286        | WITH '(' tuple_expression_list ')'
    2243                 { $$ = (StatementNode *)0; }                                    // FIX ME
     2287                { $$ = nullptr; }                                                               // FIX ME
    22442288        ;
    22452289
     
    23612405attr_name:                                                                                              // GCC
    23622406        IDENTIFIER
     2407        | quasi_keyword
    23632408        | TYPEDEFname
    23642409        | TYPEGENname
Note: See TracChangeset for help on using the changeset viewer.