Ignore:
Timestamp:
Sep 26, 2017, 11:22:08 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
d67cdb7
Parents:
9bae71f
Message:

first attempt at new basic-type int128, and length suffix with explicit size

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/parser.yy

    r9bae71f r201aeb9  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Sep 14 23:07:12 2017
    13 // Update Count     : 2815
     12// Last Modified On : Sat Sep 23 17:43:15 2017
     13// Update Count     : 2829
    1414//
    1515
     
    4343#define YYDEBUG_LEXER_TEXT (yylval)                                             // lexer loads this up each time
    4444#define YYDEBUG 1                                                                               // get the pretty debugging code to compile
    45 #define YYERROR_VERBOSE
     45#define YYERROR_VERBOSE                                                                 // more information in syntax errors
    4646
    4747#undef __GNUC_MINOR__
     
    117117bool forall = false;                                                                    // aggregate have one or more forall qualifiers ?
    118118
    119 # define YYLLOC_DEFAULT(Cur, Rhs, N)                            \
    120 do                                                              \
    121         if (N) {                                                      \
    122                 (Cur).first_line   = YYRHSLOC(Rhs, 1).first_line;           \
    123                 (Cur).first_column = YYRHSLOC(Rhs, 1).first_column;         \
    124                 (Cur).last_line    = YYRHSLOC(Rhs, N).last_line;            \
    125                 (Cur).last_column  = YYRHSLOC(Rhs, N).last_column;          \
    126                 (Cur).filename     = YYRHSLOC(Rhs, 1).filename;             \
    127         } else {                                                      \
    128                 (Cur).first_line   = (Cur).last_line   =                    \
    129                         YYRHSLOC(Rhs, 0).last_line;                               \
    130                 (Cur).first_column = (Cur).last_column =                    \
    131                         YYRHSLOC(Rhs, 0).last_column;                             \
    132                 (Cur).filename     = YYRHSLOC(Rhs, 0).filename;             \
    133         }                                                             \
    134 while (0)
     119// https://www.gnu.org/software/bison/manual/bison.html#Location-Type
     120#define YYLLOC_DEFAULT(Cur, Rhs, N)                                                                                             \
     121if ( N ) {                                                                                                                                              \
     122        (Cur).first_line   = YYRHSLOC( Rhs, 1 ).first_line;                                                     \
     123        (Cur).first_column = YYRHSLOC( Rhs, 1 ).first_column;                                           \
     124        (Cur).last_line    = YYRHSLOC( Rhs, N ).last_line;                                                      \
     125        (Cur).last_column  = YYRHSLOC( Rhs, N ).last_column;                                            \
     126        (Cur).filename     = YYRHSLOC( Rhs, 1 ).filename;                                                       \
     127} else {                                                                                                                                                \
     128        (Cur).first_line   = (Cur).last_line = YYRHSLOC( Rhs, 0 ).last_line;            \
     129        (Cur).first_column = (Cur).last_column = YYRHSLOC( Rhs, 0 ).last_column;        \
     130        (Cur).filename     = YYRHSLOC( Rhs, 0 ).filename;                                                       \
     131}
    135132%}
    136133
    137134%define parse.error verbose
    138135
    139 // Types declaration
     136// Types declaration for productions
    140137%union
    141138{
     
    173170%token VOID CHAR SHORT INT LONG FLOAT DOUBLE SIGNED UNSIGNED
    174171%token BOOL COMPLEX IMAGINARY                                                   // C99
     172%token INT128 FLOAT80 FLOAT128                                                  // GCC
    175173%token ZERO_T ONE_T                                                                             // CFA
    176174%token VALIST                                                                                   // GCC
     
    16061604
    16071605basic_type_name:
    1608         CHAR
     1606        VOID
     1607                { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
     1608        | BOOL                                                                                          // C99
     1609                { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
     1610        | CHAR
    16091611                { $$ = DeclarationNode::newBasicType( DeclarationNode::Char ); }
     1612        | INT
     1613                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
     1614        | INT128
     1615                { $$ = DeclarationNode::newBasicType( DeclarationNode::Int128 ); }
     1616        | FLOAT
     1617                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
     1618        | FLOAT80
     1619                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float80 ); }
     1620        | FLOAT128
     1621                { $$ = DeclarationNode::newBasicType( DeclarationNode::Float128 ); }
    16101622        | DOUBLE
    16111623                { $$ = DeclarationNode::newBasicType( DeclarationNode::Double ); }
    1612         | FLOAT
    1613                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Float ); }
    1614         | INT
    1615                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Int ); }
    1616         | LONG
    1617                 { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    1618         | SHORT
    1619                 { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1624        | COMPLEX                                                                                       // C99
     1625                { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
     1626        | IMAGINARY                                                                                     // C99
     1627                { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
    16201628        | SIGNED
    16211629                { $$ = DeclarationNode::newSignedNess( DeclarationNode::Signed ); }
    16221630        | UNSIGNED
    16231631                { $$ = DeclarationNode::newSignedNess( DeclarationNode::Unsigned ); }
    1624         | VOID
    1625                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Void ); }
    1626         | BOOL                                                                                          // C99
    1627                 { $$ = DeclarationNode::newBasicType( DeclarationNode::Bool ); }
    1628         | COMPLEX                                                                                       // C99
    1629                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Complex ); }
    1630         | IMAGINARY                                                                                     // C99
    1631                 { $$ = DeclarationNode::newComplexType( DeclarationNode::Imaginary ); }
     1632        | SHORT
     1633                { $$ = DeclarationNode::newLength( DeclarationNode::Short ); }
     1634        | LONG
     1635                { $$ = DeclarationNode::newLength( DeclarationNode::Long ); }
    16321636        | ZERO_T
    16331637                { $$ = DeclarationNode::newBuiltinType( DeclarationNode::Zero ); }
Note: See TracChangeset for help on using the changeset viewer.