Changes in / [cdc02f2:9507ce3]
- Files:
-
- 2 added
- 2 deleted
- 5 edited
-
doc/user/Makefile (modified) (1 diff)
-
libcfa/src/iostream.cfa (modified) (2 diffs)
-
libcfa/src/iterator.cfa (modified) (2 diffs)
-
src/Parser/lex.ll (modified) (2 diffs)
-
src/Parser/parser.yy (modified) (9 diffs)
-
tests/.expect/forctrl.txt (added)
-
tests/.expect/loopctrl.txt (deleted)
-
tests/forctrl.c (added)
-
tests/loopctrl.c (deleted)
Legend:
- Unmodified
- Added
- Removed
-
doc/user/Makefile
rcdc02f2 r9507ce3 79 79 ## Define the default recipes. 80 80 81 ${Build} :81 ${Build}: 82 82 mkdir -p ${Build} 83 83 -
libcfa/src/iostream.cfa
rcdc02f2 r9507ce3 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 26 18:22:57201813 // Update Count : 47 412 // Last Modified On : Sat Aug 11 13:56:43 2018 13 // Update Count : 473 14 14 // 15 15 … … 410 410 // Local Variables: // 411 411 // tab-width: 4 // 412 // compile-command: "cfa iostream.c fa" //412 // compile-command: "cfa iostream.c" // 413 413 // End: // -
libcfa/src/iterator.cfa
rcdc02f2 r9507ce3 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Sep 26 18:23:10 201813 // Update Count : 2 912 // Last Modified On : Fri Jul 7 08:38:23 2017 13 // Update Count : 28 14 14 // 15 15 … … 33 33 // Local Variables: // 34 34 // tab-width: 4 // 35 // compile-command: "cfa iterator.c fa" //35 // compile-command: "cfa iterator.c" // 36 36 // End: // -
src/Parser/lex.ll
rcdc02f2 r9507ce3 10 10 * Created On : Sat Sep 22 08:58:10 2001 11 11 * Last Modified By : Peter A. Buhr 12 * Last Modified On : Sat Oct 20 09:42:45201813 * Update Count : 68 712 * Last Modified On : Wed Aug 29 15:02:41 2018 13 * Update Count : 686 14 14 */ 15 15 … … 209 209 __attribute__ { KEYWORD_RETURN(ATTRIBUTE); } // GCC 210 210 auto { KEYWORD_RETURN(AUTO); } 211 basetypeof { KEYWORD_RETURN(BASETYPEOF); } // CFA212 211 _Bool { KEYWORD_RETURN(BOOL); } // C99 213 212 break { KEYWORD_RETURN(BREAK); } -
src/Parser/parser.yy
rcdc02f2 r9507ce3 10 10 // Created On : Sat Sep 1 20:22:55 2001 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Oct 21 08:27:29201813 // Update Count : 40 4512 // Last Modified On : Thu Aug 30 17:02:25 2018 13 // Update Count : 4029 14 14 // 15 15 … … 186 186 } // fieldDecl 187 187 188 ExpressionNode *forInc( const OperKinds op ) { 189 return new ExpressionNode( build_constantInteger( *new string( op == OperKinds::LThan || op == OperKinds::LEThan ? "1" : "-1" ) ) ); 190 } // forInc 191 188 192 ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) { 189 193 ConstantExpr *constant = dynamic_cast<ConstantExpr *>(type->get_expr()); … … 194 198 distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ), 195 199 new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ), 196 new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto 197 OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) ); 200 new ExpressionNode( build_binary_val( OperKinds::PlusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) ); 198 201 } // forCtrl 199 202 … … 258 261 %token ZERO_T ONE_T // CFA 259 262 %token VALIST // GCC 260 %token TYPEOF BASETYPEOF LABEL// GCC263 %token TYPEOF LABEL // GCC 261 264 %token ENUM STRUCT UNION 262 265 %token EXCEPTION // CFA … … 633 636 { $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); } 634 637 | postfix_expression ARROW no_attr_identifier 635 { $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); } 638 { 639 $$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) ); 640 } 636 641 | postfix_expression ARROW INTEGERconstant // CFA, tuple index 637 642 { $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); } … … 1141 1146 } else { 1142 1147 $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1143 OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) )) );1148 OperKinds::LThan, $1->clone(), forInc( OperKinds::LThan ) ); 1144 1149 } // if 1145 1150 } 1146 1151 | constant_expression inclexcl constant_expression // CFA 1147 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) )) ); }1152 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, forInc( $2 ) ); } 1148 1153 | constant_expression inclexcl constant_expression '~' constant_expression // CFA 1149 1154 { $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); } … … 1157 1162 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1158 1163 $$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ), 1159 OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) )) );1164 OperKinds::LThan, $3->clone(), forInc( OperKinds::LThan ) ); 1160 1165 } else { 1161 1166 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; … … 1169 1174 } else { 1170 1175 if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) { 1171 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) )) );1176 $$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, forInc( $4 ) ); 1172 1177 } else { 1173 1178 SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr; … … 1854 1859 | TYPEOF '(' comma_expression ')' // GCC: typeof(a+b) y; 1855 1860 { $$ = DeclarationNode::newTypeof( $3 ); } 1856 | BASETYPEOF '(' type ')' // CFA: basetypeof(x) y;1857 { $$ = $3; }1858 | BASETYPEOF '(' comma_expression ')' // CFA: basetypeof(a+b) y;1859 { $$ = DeclarationNode::newTypeof( $3 ); }1860 1861 | ATTR_TYPEGENname '(' type ')' // CFA: e.g., @type(x) y; 1861 1862 { $$ = DeclarationNode::newAttr( $1, $3 ); }
Note:
See TracChangeset
for help on using the changeset viewer.