Changes in / [1997b4e:3b2b37f]
- Location:
- src
- Files:
-
- 6 edited
-
Parser/lex.ll (modified) (2 diffs)
-
Parser/parser.yy (modified) (12 diffs)
-
prelude/builtins.c (modified) (2 diffs)
-
tests/function-operator.c (modified) (3 diffs)
-
tests/sum.c (modified) (2 diffs)
-
tests/tuple/tupleVariadic.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/lex.ll
r1997b4e r3b2b37f 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Wed Jun 20 09:08:28201813 * Update Count : 68 212 * Last Modified On : Wed Aug 8 17:23:17 2018 13 * Update Count : 685 14 14 */ 15 15 … … 410 410 ">>=" { NAMEDOP_RETURN(RSassign); } 411 411 412 "~=" { NAMEDOP_RETURN(Erange); } // CFA 412 413 "@=" { NAMEDOP_RETURN(ATassign); } // CFA 413 414 -
src/Parser/parser.yy
r1997b4e r3b2b37f 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 4 09:38:36201813 // Update Count : 39 8612 // Last Modified On : Wed Aug 8 17:50:07 2018 13 // Update Count : 3998 14 14 // 15 15 … … 186 186 } // fieldDecl 187 187 188 ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, ExpressionNode * comp, ExpressionNode * inc ) {188 ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) { 189 189 return new ForCtrl( 190 190 distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ), 191 new ExpressionNode( build_binary_val( OperKinds::LThan, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ),191 new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ), 192 192 new ExpressionNode( build_binary_val( OperKinds::PlusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) ); 193 193 } // forCtrl … … 227 227 IfCtrl * ifctl; 228 228 ForCtrl * fctl; 229 enum OperKinds compop; 229 230 LabelNode * label; 230 231 InitializerNode * in; … … 289 290 %token ANDassign ERassign ORassign // &= ^= |= 290 291 292 %token Erange // ~= 291 293 %token ATassign // @= 292 294 … … 311 313 %type<ifctl> if_control_expression 312 314 %type<fctl> for_control_expression 315 %type<compop> inclexcl 313 316 %type<en> subrange 314 317 %type<decl> asm_name_opt … … 1135 1138 $$ = new ForCtrl( (ExpressionNode * )nullptr, (ExpressionNode * )nullptr, (ExpressionNode * )nullptr ); 1136 1139 } else { 1137 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), $1->clone(),1140 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $1->clone(), 1138 1141 new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); 1139 1142 } // if 1140 1143 } 1141 | constant_expression '~' constant_expression// CFA1142 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $ 3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }1143 | constant_expression '~'constant_expression '~' constant_expression // CFA1144 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $ 3, $5 ); }1144 | constant_expression inclexcl constant_expression // CFA 1145 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); } 1146 | constant_expression inclexcl constant_expression '~' constant_expression // CFA 1147 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); } 1145 1148 | comma_expression_opt ';' comma_expression // CFA 1146 1149 { … … 1151 1154 } else { 1152 1155 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1153 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), $3->clone(),1156 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), OperKinds::LThan, $3->clone(), 1154 1157 new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); 1155 1158 } else { … … 1158 1161 } // if 1159 1162 } 1160 | comma_expression_opt ';' constant_expression '~'constant_expression // CFA1163 | comma_expression_opt ';' constant_expression inclexcl constant_expression // CFA 1161 1164 { 1162 1165 if ( ! $1 ) { … … 1164 1167 } else { 1165 1168 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1166 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $ 5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );1169 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); 1167 1170 } else { 1168 1171 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; … … 1170 1173 } // if 1171 1174 } 1172 | comma_expression_opt ';' constant_expression '~'constant_expression '~' constant_expression // CFA1175 | comma_expression_opt ';' constant_expression inclexcl constant_expression '~' constant_expression // CFA 1173 1176 { 1174 1177 if ( ! $1 ) { … … 1176 1179 } else { 1177 1180 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1178 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $ 5, $7 );1181 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, $7 ); 1179 1182 } else { 1180 1183 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; … … 1186 1189 | declaration comma_expression_opt ';' comma_expression_opt // C99, declaration has ';' 1187 1190 { $$ = new ForCtrl( $1, $2, $4 ); } 1191 ; 1192 1193 inclexcl: 1194 '~' 1195 { $$ = OperKinds::LThan; } 1196 | Erange 1197 { $$ = OperKinds::LEThan; } 1188 1198 ; 1189 1199 -
src/prelude/builtins.c
r1997b4e r3b2b37f 10 10 // Created On : Fri Jul 21 16:21:03 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Feb 8 12:47:59201813 // Update Count : 1912 // Last Modified On : Sun Aug 5 21:40:38 2018 13 // Update Count : 20 14 14 // 15 15 … … 22 22 23 23 void exit( int status, const char fmt[], ... ) __attribute__ (( format(printf, 2, 3), __nothrow__, __leaf__, __noreturn__ )); 24 void abort ( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ ));24 void abort( const char fmt[], ... ) __attribute__ (( format(printf, 1, 2), __nothrow__, __leaf__, __noreturn__ )); 25 25 26 26 // increment/decrement unification -
src/tests/function-operator.c
r1997b4e r3b2b37f 10 10 // Created On : Fri Aug 25 15:21:11 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Dec 7 12:42:26 201713 // Update Count : 612 // Last Modified On : Thu Aug 2 09:27:53 2018 13 // Update Count : 8 14 14 // 15 15 … … 92 92 void ?{}(ostream_iterator & iter, ofstream * out) { 93 93 iter.out = new(out); 94 }94 } 95 95 // no destructor, memory leak. This is necessary for this to work at the moment, since 96 96 // *? requires its parameter by value and returns a reference. … … 168 168 transform(begin(x), end(x), begin(x), ×2); 169 169 copy(begin(x), end(x), out_iter); 170 171 // REMOVE WHEN ?* PROBLEM FIXED. 172 delete(out_iter.out); 170 173 } 171 174 -
src/tests/sum.c
r1997b4e r3b2b37f 11 11 // Created On : Wed May 27 17:56:53 2015 12 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Jun 3 19:23:41201814 // Update Count : 27 813 // Last Modified On : Thu Aug 2 08:03:09 2018 14 // Update Count : 279 15 15 // 16 16 … … 115 115 sout | "sum from" | low | "to" | High | "is" 116 116 | sum( size, gs.x ) | ", check" | (int)s | endl; // add field array in generic type 117 delete( gs.x ); 117 118 } // main 118 119 -
src/tests/tuple/tupleVariadic.c
r1997b4e r3b2b37f 9 9 // Author : Rob Schluntz 10 10 // Created On : Fri Dec 16 10:25:35 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Dec 21 14:42:48 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 2 09:24:04 2018 13 // Update Count : 6 14 14 // 15 16 #include <stdlib> 15 17 16 18 void func(void) { … … 28 30 printf("called process(double) %g\n", x); 29 31 } 30 31 forall( dtype T, ttype Params | sized(T) | { void ?{}(T &, Params); } )32 T * new(Params p);33 32 34 33 struct array { … … 66 65 a.data[2] = a2; 67 66 printf("called ?{} with a: %d %d %d\n", a0, a1, a2); 67 } 68 69 void ^?{}(array & a) { 70 free(a.data); 68 71 } 69 72 … … 126 129 bar(x); 127 130 } 131 132 delete(ptr); 133 delete(x4); 134 delete(x3); 135 delete(x2); 136 delete(x1); 137 delete(x0); 128 138 } 129 139 … … 131 141 // tab-width: 4 // 132 142 // End: // 133
Note:
See TracChangeset
for help on using the changeset viewer.