Changeset a12d5aa for src/Parser
- Timestamp:
- Jun 29, 2017, 5:13:42 PM (8 years ago)
- 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:
- 435e75f
- Parents:
- 62423350 (diff), 1abc5ab (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. - Location:
- src/Parser
- Files:
-
- 11 edited
- 3 moved
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/DeclarationNode.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 12:34:05 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:46:33201713 // Update Count : 101 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:27:00 2017 13 // Update Count : 1019 14 14 // 15 15 … … 1063 1063 case TypeData::Enum: 1064 1064 case TypeData::Aggregate: { 1065 ReferenceToType * ret = buildComAggInst( type, attributes );1065 ReferenceToType * ret = buildComAggInst( type, attributes, linkage ); 1066 1066 buildList( type->aggregate.actuals, ret->get_parameters() ); 1067 1067 return ret; -
src/Parser/ExpressionNode.cc
r62423350 ra12d5aa 10 10 // Created On : Sat May 16 13:17:07 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 2 1 16:44:46201713 // Update Count : 54 112 // Last Modified On : Wed Jun 28 21:08:15 2017 13 // Update Count : 542 14 14 // 15 15 … … 27 27 #include "SynTree/Declaration.h" 28 28 #include "Common/UnimplementedError.h" 29 #include "parse utility.h"29 #include "parserutility.h" 30 30 #include "Common/utility.h" 31 31 -
src/Parser/LinkageSpec.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:22:09 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sun Oct 2 23:16:21 201613 // Update Count : 2 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:51:00 2017 13 // Update Count : 24 14 14 // 15 15 … … 28 28 } else if ( *spec == "\"C\"" ) { 29 29 return C; 30 } else if ( *spec == "\"BuiltinC\"" ) { 31 return BuiltinC; 30 32 } else { 31 33 throw SemanticError( "Invalid linkage specifier " + *spec ); … … 36 38 assert( 0 <= linkage && linkage < LinkageSpec::NoOfSpecs ); 37 39 static const char *linkageKinds[LinkageSpec::NoOfSpecs] = { 38 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", 40 "intrinsic", "Cforall", "C", "automatically generated", "compiler built-in", "cfa built-in", "c built-in", 39 41 }; 40 42 return linkageKinds[linkage]; 41 43 } 42 44 43 bool LinkageSpec::is Decoratable( Spec spec ) {45 bool LinkageSpec::isMangled( Spec spec ) { 44 46 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 45 47 static bool decoratable[LinkageSpec::NoOfSpecs] = { 46 // Intrinsic, Cforall, C, AutoGen, Compiler 48 // Intrinsic, Cforall, C, AutoGen, Compiler, 47 49 true, true, false, true, false, 50 // Builtin, BuiltinC, 51 true, false, 48 52 }; 49 53 return decoratable[spec]; … … 53 57 assert( 0 <= spec && spec < LinkageSpec::NoOfSpecs ); 54 58 static bool generatable[LinkageSpec::NoOfSpecs] = { 55 // Intrinsic, Cforall, C, AutoGen, Compiler 59 // Intrinsic, Cforall, C, AutoGen, Compiler, 56 60 true, true, true, true, false, 61 // Builtin, BuiltinC, 62 true, true, 57 63 }; 58 64 return generatable[spec]; … … 62 68 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 63 69 static bool overridable[LinkageSpec::NoOfSpecs] = { 64 // Intrinsic, Cforall, C, AutoGen, Compiler 70 // Intrinsic, Cforall, C, AutoGen, Compiler, 65 71 true, false, false, true, false, 72 // Builtin, BuiltinC, 73 false, false, 66 74 }; 67 75 return overridable[spec]; … … 71 79 assert( spec >= 0 && spec < LinkageSpec::NoOfSpecs ); 72 80 static bool builtin[LinkageSpec::NoOfSpecs] = { 73 // Intrinsic, Cforall, C, AutoGen, Compiler 81 // Intrinsic, Cforall, C, AutoGen, Compiler, 74 82 true, false, false, false, true, 83 // Builtin, BuiltinC, 84 true, true, 75 85 }; 76 86 return builtin[spec]; -
src/Parser/LinkageSpec.h
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:24:28 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sat Oct 1 23:03:17 201613 // Update Count : 1 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 11:50:00 2017 13 // Update Count : 12 14 14 // 15 15 … … 26 26 AutoGen, // built by translator (struct assignment) 27 27 Compiler, // gcc internal 28 Builtin, // mangled builtins 29 BuiltinC, // non-mangled builtins 28 30 NoOfSpecs 29 31 }; … … 32 34 static std::string linkageName( Spec ); 33 35 34 static bool is Decoratable( Spec );36 static bool isMangled( Spec ); 35 37 static bool isGeneratable( Spec ); 36 38 static bool isOverridable( Spec ); -
src/Parser/StatementNode.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 14:59:41 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Jun 12 13:03:00201713 // Update Count : 3 2911 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 28 21:08:37 2017 13 // Update Count : 330 14 14 // 15 15 … … 21 21 #include "SynTree/Statement.h" 22 22 #include "SynTree/Expression.h" 23 #include "parse utility.h"23 #include "parserutility.h" 24 24 #include "Common/utility.h" 25 25 -
src/Parser/TypeData.cc
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:12:51 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 15:52:43201713 // Update Count : 56 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:28:00 2017 13 // Update Count : 564 14 14 // 15 15 … … 614 614 } // buildPointer 615 615 616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes ) {616 AggregateDecl * buildAggregate( const TypeData * td, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { 617 617 assert( td->kind == TypeData::Aggregate ); 618 618 AggregateDecl * at; … … 622 622 case DeclarationNode::Monitor: 623 623 case DeclarationNode::Thread: 624 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes );624 at = new StructDecl( *td->aggregate.name, td->aggregate.kind, attributes, linkage ); 625 625 buildForall( td->aggregate.params, at->get_parameters() ); 626 626 break; … … 643 643 } // buildAggregate 644 644 645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes ) {645 ReferenceToType * buildComAggInst( const TypeData * type, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ) { 646 646 switch ( type->kind ) { 647 647 case TypeData::Enum: { … … 656 656 ReferenceToType * ret; 657 657 if ( type->aggregate.body ) { 658 AggregateDecl * typedecl = buildAggregate( type, attributes );658 AggregateDecl * typedecl = buildAggregate( type, attributes, linkage ); 659 659 switch ( type->aggregate.kind ) { 660 660 case DeclarationNode::Struct: … … 803 803 return decl->set_asmName( asmName ); 804 804 } else if ( td->kind == TypeData::Aggregate ) { 805 return buildAggregate( td, attributes );805 return buildAggregate( td, attributes, linkage ); 806 806 } else if ( td->kind == TypeData::Enum ) { 807 807 return buildEnum( td, attributes ); -
src/Parser/TypeData.h
r62423350 ra12d5aa 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:18:36 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 16 08:32:39201713 // Update Count : 18 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Jun 28 15:29:00 2017 13 // Update Count : 186 14 14 // 15 15 … … 102 102 ArrayType * buildArray( const TypeData * ); 103 103 AggregateDecl * buildAggregate( const TypeData *, std::list< Attribute * > ); 104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes );104 ReferenceToType * buildComAggInst( const TypeData *, std::list< Attribute * > attributes, LinkageSpec::Spec linkage ); 105 105 ReferenceToType * buildAggInst( const TypeData * ); 106 106 TypeDecl * buildVariable( const TypeData * ); -
src/Parser/TypedefTable.h
r62423350 ra12d5aa 10 10 // Created On : Sat May 16 15:24:36 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Aug 15 18:25:04 201613 // Update Count : 2812 // Last Modified On : Wed Jun 28 21:56:34 2017 13 // Update Count : 33 14 14 // 15 15 … … 22 22 #include <stack> 23 23 24 #include " lex.h"24 #include "parser.hh" 25 25 #include "parser.h" 26 26 -
src/Parser/lex.ll
r62423350 ra12d5aa 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Tue May 30 22:00:48201713 * Update Count : 52 712 * Last Modified On : Wed Jun 28 21:03:45 2017 13 * Update Count : 529 14 14 */ 15 15 … … 27 27 #include <cstdio> // FILENAME_MAX 28 28 29 #include "lex.h"30 #include "parser.h" // YACC generated definitions based on C++ grammar31 29 #include "ParseNode.h" 32 30 #include "TypedefTable.h" -
src/Parser/module.mk
r62423350 ra12d5aa 11 11 ## Created On : Sat May 16 15:29:09 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Tue Aug 16 17:28:34 201614 ## Update Count : 10 113 ## Last Modified On : Wed Jun 28 21:58:29 2017 14 ## Update Count : 104 15 15 ############################################################################### 16 16 … … 29 29 Parser/TypeData.cc \ 30 30 Parser/LinkageSpec.cc \ 31 Parser/parse utility.cc31 Parser/parserutility.cc 32 32 33 33 MAINTAINERCLEANFILES += Parser/parser.output -
src/Parser/parser.hh
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // lex.h --7 // parser.hh -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 22 08:58:10 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Aug 21 11:28:47 201613 // Update Count : 34 712 // Last Modified On : Wed Jun 28 22:10:17 2017 13 // Update Count : 349 14 14 // 15 15 16 #ifndef PARSER_ LEX_H17 #define PARSER_ LEX_H16 #ifndef PARSER_HH 17 #define PARSER_HH 18 18 19 19 int yylex(); … … 42 42 }; // Token 43 43 44 #endif // PARSER_ LEX_H44 #endif // PARSER_HH 45 45 46 46 // Local Variables: // -
src/Parser/parser.yy
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // cfa.y --7 // parser.yy -- 8 8 // 9 9 // Author : Peter A. Buhr 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 12 12:59:00201713 // Update Count : 24 0212 // Last Modified On : Wed Jun 28 22:11:22 2017 13 // Update Count : 2414 14 14 // 15 15 … … 48 48 #include <cstdio> 49 49 #include <stack> 50 #include "lex.h"51 #include "parser.h"52 50 #include "ParseNode.h" 53 51 #include "TypedefTable.h" … … 88 86 bool forall = false; // aggregate have one or more forall qualifiers ? 89 87 %} 88 89 // Types declaration 90 %union 91 { 92 Token tok; 93 ParseNode * pn; 94 ExpressionNode * en; 95 DeclarationNode * decl; 96 DeclarationNode::Aggregate aggKey; 97 DeclarationNode::TypeClass tclass; 98 StatementNode * sn; 99 ConstantExpr * constant; 100 ForCtl * fctl; 101 LabelNode * label; 102 InitializerNode * in; 103 OperKinds op; 104 std::string * str; 105 bool flag; 106 } 90 107 91 108 //************************* TERMINAL TOKENS ******************************** … … 139 156 140 157 %token ATassign // @= 141 142 // Types declaration143 %union144 {145 Token tok;146 ParseNode * pn;147 ExpressionNode * en;148 DeclarationNode * decl;149 DeclarationNode::Aggregate aggKey;150 DeclarationNode::TypeClass tclass;151 StatementNode * sn;152 ConstantExpr * constant;153 ForCtl * fctl;154 LabelNode * label;155 InitializerNode * in;156 OperKinds op;157 std::string * str;158 bool flag;159 }160 158 161 159 %type<tok> identifier no_attr_identifier zero_one … … 959 957 960 958 handler_clause: 961 CATCH '(' push push exception_declaration pop ')' compound_statement pop 959 // TEMPORARY, TEST EXCEPTIONS 960 CATCH '(' push push INTEGERconstant pop ')' compound_statement pop 961 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$5 ) ), $8 ) ); } 962 | handler_clause CATCH '(' push push INTEGERconstant pop ')' compound_statement pop 963 { $$ = (StatementNode *)$1->set_last( new StatementNode( build_catch( CatchStmt::Terminate, nullptr, new ExpressionNode( build_constantInteger( *$6 ) ), $9 ) ) ); } 964 965 | CATCH '(' push push exception_declaration pop ')' compound_statement pop 962 966 { $$ = new StatementNode( build_catch( CatchStmt::Terminate, $5, nullptr, $8 ) ); } 963 967 | handler_clause CATCH '(' push push exception_declaration pop ')' compound_statement pop -
src/Parser/parserutility.cc
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // parse utility.cc --7 // parserutility.cc -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:30:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jun 2 1 15:33:41201713 // Update Count : 512 // Last Modified On : Wed Jun 28 22:11:32 2017 13 // Update Count : 7 14 14 // 15 15 16 #include "parse utility.h"16 #include "parserutility.h" 17 17 #include "SynTree/Type.h" 18 18 #include "SynTree/Expression.h" -
src/Parser/parserutility.h
r62423350 ra12d5aa 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // parse utility.h --7 // parserutility.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 15:31:46 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat May 16 15:32:58 201513 // Update Count : 212 // Last Modified On : Wed Jun 28 22:11:40 2017 13 // Update Count : 3 14 14 // 15 15
Note:
See TracChangeset
for help on using the changeset viewer.