Index: src/Parser/lex.ll
===================================================================
--- src/Parser/lex.ll	(revision d6a98f37fa4e3f1e1b998f71294d9cfb2c2c2085)
+++ src/Parser/lex.ll	(revision b6ad601afc2b4ebc704c5026ec01e1ef6347ff8e)
@@ -10,6 +10,6 @@
  * Created On       : Sat Sep 22 08:58:10 2001
  * Last Modified By : Peter A. Buhr
- * Last Modified On : Wed Aug 29 15:02:41 2018
- * Update Count     : 686
+ * Last Modified On : Thu Nov  1 20:57:35 2018
+ * Update Count     : 687
  */
 
@@ -209,4 +209,5 @@
 __attribute__	{ KEYWORD_RETURN(ATTRIBUTE); }			// GCC
 auto			{ KEYWORD_RETURN(AUTO); }
+basetypeof		{ KEYWORD_RETURN(BASETYPEOF); }			// CFA
 _Bool			{ KEYWORD_RETURN(BOOL); }				// C99
 break			{ KEYWORD_RETURN(BREAK); }
Index: src/Parser/parser.yy
===================================================================
--- src/Parser/parser.yy	(revision d6a98f37fa4e3f1e1b998f71294d9cfb2c2c2085)
+++ src/Parser/parser.yy	(revision b6ad601afc2b4ebc704c5026ec01e1ef6347ff8e)
@@ -10,6 +10,6 @@
 // Created On       : Sat Sep  1 20:22:55 2001
 // Last Modified By : Peter A. Buhr
-// Last Modified On : Thu Aug 30 17:02:25 2018
-// Update Count     : 4029
+// Last Modified On : Thu Nov  1 20:59:49 2018
+// Update Count     : 4030
 //
 
@@ -186,8 +186,4 @@
 } // fieldDecl
 
-ExpressionNode *forInc( const OperKinds op ) {
-	return new ExpressionNode( build_constantInteger( *new string( op == OperKinds::LThan || op == OperKinds::LEThan ? "1" : "-1" ) ) );
-} // forInc
-
 ForCtrl * forCtrl( ExpressionNode * type, string * index, ExpressionNode * start, enum OperKinds compop, ExpressionNode * comp, ExpressionNode * inc ) {
 	ConstantExpr *constant = dynamic_cast<ConstantExpr *>(type->get_expr());
@@ -198,5 +194,6 @@
 		distAttr( DeclarationNode::newTypeof( type ), DeclarationNode::newName( index )->addInitializer( new InitializerNode( start ) ) ),
 		new ExpressionNode( build_binary_val( compop, new ExpressionNode( build_varref( new string( *index ) ) ), comp ) ),
-		new ExpressionNode( build_binary_val( OperKinds::PlusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) );
+		new ExpressionNode( build_binary_val( compop == OperKinds::LThan || compop == OperKinds::LEThan ? // choose += or -= for upto/downto
+											  OperKinds::PlusAssn : OperKinds::MinusAssn, new ExpressionNode( build_varref( new string( *index ) ) ), inc ) ) );
 } // forCtrl
 
@@ -261,5 +258,5 @@
 %token ZERO_T ONE_T										// CFA
 %token VALIST											// GCC
-%token TYPEOF LABEL										// GCC
+%token TYPEOF BASETYPEOF LABEL							// GCC
 %token ENUM STRUCT UNION
 %token EXCEPTION										// CFA
@@ -636,7 +633,5 @@
 		{ $$ = new ExpressionNode( build_fieldSel( $1, build_tuple( $4 ) ) ); }
 	| postfix_expression ARROW no_attr_identifier
-		{
-			$$ = new ExpressionNode( build_pfieldSel( $1, *$3 == "0" || *$3 == "1" ? build_constantInteger( *$3 ) : build_varref( $3 ) ) );
-		}
+		{ $$ = new ExpressionNode( build_pfieldSel( $1, build_varref( $3 ) ) ); }
 	| postfix_expression ARROW INTEGERconstant			// CFA, tuple index
 		{ $$ = new ExpressionNode( build_pfieldSel( $1, build_constantInteger( *$3 ) ) ); }
@@ -1146,9 +1141,9 @@
 			} else {
 				$$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
-							  OperKinds::LThan, $1->clone(), forInc( OperKinds::LThan ) );
+							  OperKinds::LThan, $1->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
 			} // if
 		}
 	| constant_expression inclexcl constant_expression	// CFA
-		{ $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, forInc( $2 ) ); }
+		{ $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) ); }
 	| constant_expression inclexcl constant_expression '~' constant_expression // CFA
 		{ $$ = forCtrl( $1, new string( DeclarationNode::anonymous.newName() ), $1->clone(), $2, $3, $5 ); }
@@ -1162,5 +1157,5 @@
 				if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
 					$$ = forCtrl( $3, new string( identifier->name ), new ExpressionNode( build_constantInteger( *new string( "0" ) ) ),
-								  OperKinds::LThan, $3->clone(), forInc( OperKinds::LThan ) );
+								  OperKinds::LThan, $3->clone(), new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
 				} else {
 					SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
@@ -1174,5 +1169,5 @@
 			} else {
 				if ( NameExpr *identifier = dynamic_cast<NameExpr *>($1->get_expr()) ) {
-					$$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, forInc( $4 ) );
+					$$ = forCtrl( $3, new string( identifier->name ), $3->clone(), $4, $5, new ExpressionNode( build_constantInteger( *new string( "1" ) ) ) );
 				} else {
 					SemanticError( yylloc, "Expression disallowed. Only loop-index name allowed" ); $$ = nullptr;
@@ -1855,11 +1850,15 @@
 
 indirect_type:
-	TYPEOF '(' type ')'									// GCC: typeof(x) y;
+	TYPEOF '(' type ')'									// GCC: typeof( x ) y;
 		{ $$ = $3; }
-	| TYPEOF '(' comma_expression ')'					// GCC: typeof(a+b) y;
+	| TYPEOF '(' comma_expression ')'					// GCC: typeof( a+b ) y;
 		{ $$ = DeclarationNode::newTypeof( $3 ); }
-	| ATTR_TYPEGENname '(' type ')'						// CFA: e.g., @type(x) y;
+	| BASETYPEOF '(' type ')'							// CFA: basetypeof( x ) y;
+		{ $$ = DeclarationNode::newTypeof( new ExpressionNode( new TypeExpr( maybeMoveBuildType( $3 ) ) ), true ); }
+	| BASETYPEOF '(' comma_expression ')'				// CFA: basetypeof( a+b ) y;
+		{ $$ = DeclarationNode::newTypeof( $3, true ); }
+	| ATTR_TYPEGENname '(' type ')'						// CFA: e.g., @type( x ) y;
 		{ $$ = DeclarationNode::newAttr( $1, $3 ); }
-	| ATTR_TYPEGENname '(' comma_expression ')'			// CFA: e.g., @type(a+b) y;
+	| ATTR_TYPEGENname '(' comma_expression ')'			// CFA: e.g., @type( a+b ) y;
 		{ $$ = DeclarationNode::newAttr( $1, $3 ); }
 	| ZERO_T											// CFA
Index: sts/.expect/forctrl.txt
===================================================================
--- tests/.expect/forctrl.txt	(revision d6a98f37fa4e3f1e1b998f71294d9cfb2c2c2085)
+++ 	(revision )
@@ -1,24 +1,0 @@
-empty
-empty
-empty
-
-A
-A A
-A A A A A A A A A A
-B B B B B
-C C C C C
-D D D D D
-E E E E E
-0 1 2 3 4 5 6 7 8 9
-0 1 2 3 4 5 6 7 8 9
-1 3 5 7 9
-10 8 6 4 2
-0.5 1.5 2.5 3.5 4.5
-5.5 4.5 3.5 2.5 1.5
-2 4 6 8 10
-10 8 6 4 2
-3 6 9
-(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
-(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
-(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
-(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
Index: tests/.expect/loopctrl.txt
===================================================================
--- tests/.expect/loopctrl.txt	(revision b6ad601afc2b4ebc704c5026ec01e1ef6347ff8e)
+++ tests/.expect/loopctrl.txt	(revision b6ad601afc2b4ebc704c5026ec01e1ef6347ff8e)
@@ -0,0 +1,35 @@
+empty
+empty
+empty
+
+zero
+A
+A A A A A A A A A A
+B B B B B
+C C C C C
+D D D D D
+E E E E E
+
+0 1 2 3 4 5 6 7 8 9
+1 3 5 7 9
+10 8 6 4 2
+0.5 1.5 2.5 3.5 4.5
+5.5 4.5 3.5 2.5 1.5
+2 4 6 8 10
+10 8 6 4 2
+
+
+3 6 9
+
+(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
+(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
+
+(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
+(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)
+(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)(10 10)
+(0 0)(1 1)(2 2)(3 3)(4 4)(5 5)(6 6)(7 7)(8 8)(9 9)(10 10)
+
+(10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)
+(10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)
+(10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)(0 0)
+(10 10)(9 9)(8 8)(7 7)(6 6)(5 5)(4 4)(3 3)(2 2)(1 1)(0 0)
Index: sts/forctrl.c
===================================================================
--- tests/forctrl.c	(revision d6a98f37fa4e3f1e1b998f71294d9cfb2c2c2085)
+++ 	(revision )
@@ -1,69 +1,0 @@
-// 
-// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
-//
-// The contents of this file are covered under the licence agreement in the
-// file "LICENCE" distributed with Cforall.
-// 
-// forctrl.c -- 
-// 
-// Author           : Peter A. Buhr
-// Created On       : Wed Aug  8 18:32:59 2018
-// Last Modified By : Peter A. Buhr
-// Last Modified On : Tue Sep 25 17:43:47 2018
-// Update Count     : 44
-// 
-
-#include <fstream.hfa>
-
-struct S { int i, j; };
-void ?{}( S & s ) { s.[i, j] = 0; }
-void ?{}( S & s, int i ) { s.[i, j] = [i, 0]; }
-void ?{}( S & s, int i, int j ) { s.[i, j] = [i, j]; }
-void ?{}( S & s, zero_t ) { s.[i, j] = 0; }
-void ?{}( S & s, one_t ) { s.[i, j] = 1; }
-S ?+?( S t1, S t2 ) { return (S){ t1.i + t2.i, t1.j + t2.j }; }
-int ?<?( S t1, S t2 ) { return t1.i < t2.i && t1.j < t2.j; }
-S ?=?( S & t1, S t2 ) { t1.i = t2.i; t1.j = t2.j; return t1; }
-S ?+=?( S & t1, S t2 ) { t1 = t1 + t2; return t1; }
-S ?+=?( S & t1, one_t ) { t1 = t1 + (S){1}; return t1; }
-ofstream & ?|?( ofstream & os, S v ) { return os | '(' | v.i | v.j | ')'; }
-
-int main() {
-	while () { sout | "empty"; break; }		sout | endl;
-	do { sout | "empty"; break; } while ();	sout | endl;
-	for () { sout | "empty"; break; }		sout | endl;
-
-	for ( 0 ) { sout | "A"; }				sout | endl;
-	for ( 1 ) { sout | "A"; }				sout | endl;
-	for ( 2 ) { sout | "A"; }				sout | endl;
-	for ( 10 ) { sout | "A"; }				sout | endl;
-
-	for ( 1 ~= 10 ~ 2 ) { sout | "B"; }		sout | endl;
-	for ( 10 -~= 1 ~ -2 ) { sout | "C"; }	sout | endl;
-	for ( 0.5 ~ 5.5 ) { sout | "D"; }		sout | endl;
-	for ( 5.5 -~ 0.5 ) { sout | "E"; }		sout | endl;
-
-	for ( i; 10 ) { sout | i; }				sout | endl;
-	for ( j; 10 ) { sout | j; }				sout | endl;
-
-	for ( i; 1 ~= 10 ~ 2 ) { sout | i; }	sout | endl;
-	for ( i; 10 -~= 1 ~ -2 ) { sout | i; }	sout | endl;
-	for ( i; 0.5 ~ 5.5 ) { sout | i; }		sout | endl;
-	for ( i; 5.5 -~ 0.5 ) { sout | i; }		sout | endl;
-
-	for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; } sout | endl;
-	for ( ui; 10u -~= 2u ~ -2u ) { sout | ui; } sout | endl;
-
-	int start = 3, comp = 10, inc = 2;
-	for ( i; start ~ comp ~ inc + 1 ) { sout | i; } sout | endl;
-
-	for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | endl;
-	for ( s; (S){10,10} ) { sout | s; } sout | endl;
-	for ( s; (S){0} ~ (S){10,10} ) { sout | s; } sout | endl;
-	for ( s; (S){0} ~ (S){10,10} ~ (S){1} ) { sout | s; } sout | endl;
-}
-
-// Local Variables: //
-// tab-width: 4 //
-// compile-command: "cfa forctrl.c" //
-// End: //
Index: tests/loopctrl.c
===================================================================
--- tests/loopctrl.c	(revision b6ad601afc2b4ebc704c5026ec01e1ef6347ff8e)
+++ tests/loopctrl.c	(revision b6ad601afc2b4ebc704c5026ec01e1ef6347ff8e)
@@ -0,0 +1,79 @@
+// 
+// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
+//
+// The contents of this file are covered under the licence agreement in the
+// file "LICENCE" distributed with Cforall.
+// 
+// forctrl.c -- 
+// 
+// Author           : Peter A. Buhr
+// Created On       : Wed Aug  8 18:32:59 2018
+// Last Modified By : Peter A. Buhr
+// Last Modified On : Thu Nov  1 23:11:23 2018
+// Update Count     : 46
+// 
+
+#include <fstream.hfa>
+
+struct S { int i, j; };
+void ?{}( S & s ) { s.[i, j] = 0; }
+void ?{}( S & s, int i ) { s.[i, j] = [i, 0]; }
+void ?{}( S & s, int i, int j ) { s.[i, j] = [i, j]; }
+void ?{}( S & s, zero_t ) { s.[i, j] = 0; }
+void ?{}( S & s, one_t ) { s.[i, j] = 1; }
+int ?<?( S t1, S t2 ) { return t1.i < t2.i && t1.j < t2.j; }
+int ?<=?( S t1, S t2 ) { return t1.i <= t2.i && t1.j <= t2.j; }
+int ?>?( S t1, S t2 ) { return t1.i > t2.i && t1.j > t2.j; }
+int ?>=?( S t1, S t2 ) { return t1.i >= t2.i && t1.j >= t2.j; }
+S ?=?( S & t1, S t2 ) { t1.i = t2.i; t1.j = t2.j; return t1; }
+S ?+=?( S & t1, S t2 ) { t1.i += t2.i; t1.j += t2.j; return t1; }
+S ?+=?( S & t, one_t ) { t.i += 1; t.j += 1; return t; }
+S ?-=?( S & t1, S t2 ) { t1.i -= t2.i; t1.j -= t2.j; return t1; }
+S ?-=?( S & t, one_t ) { t.i -= 1; t.j -= 1; return t; }
+ofstream & ?|?( ofstream & os, S v ) { return os | '(' | v.i | v.j | ')'; }
+
+int main() {
+	while () { sout | "empty"; break; }			sout | endl;
+	do { sout | "empty"; break; } while ();		sout | endl;
+	for () { sout | "empty"; break; }			sout | endl | endl;
+
+	for ( 0 ) { sout | "A"; }					sout | "zero" | endl;
+	for ( 1 ) { sout | "A"; }					sout | endl;
+	for ( 10 ) { sout | "A"; }					sout | endl;
+
+	for ( 1 ~= 10 ~ 2 ) { sout | "B"; }			sout | endl;
+	for ( 10 -~= 1 ~ 2 ) { sout | "C"; }		sout | endl;
+	for ( 0.5 ~ 5.5 ) { sout | "D"; }			sout | endl;
+	for ( 5.5 -~ 0.5 ) { sout | "E"; }			sout | endl | endl;
+
+	for ( i; 10 ) { sout | i; }					sout | endl;
+	for ( i; 1 ~= 10 ~ 2 ) { sout | i; }		sout | endl;
+	for ( i; 10 -~= 1 ~ 2 ) { sout | i; }		sout | endl;
+	for ( i; 0.5 ~ 5.5 ) { sout | i; }			sout | endl;
+	for ( i; 5.5 -~ 0.5 ) { sout | i; }			sout | endl;
+
+	for ( ui; 2u ~= 10u ~ 2u ) { sout | ui; }	sout | endl;
+	for ( ui; 10u -~= 2u ~ 2u ) { sout | ui; }	sout | endl | endl | endl;
+
+	int start = 3, comp = 10, inc = 2;
+	for ( i; start ~ comp ~ inc + 1 ) { sout | i; } sout | endl;
+
+	sout | endl;
+	for ( S s = (S){0}; s < (S){10,10}; s += (S){1} ) { sout | s; } sout | endl;
+	for ( s; (S){10,10} ) { sout | s; } sout | endl;
+	sout | endl;
+	for ( s; (S){0} ~ (S){10,10} ) { sout | s; } sout | endl;
+	for ( s; (S){0} ~ (S){10,10} ~ (S){1} ) { sout | s; } sout | endl;
+	for ( s; (S){0} ~= (S){10,10} ) { sout | s; } sout | endl;
+	for ( s; (S){0} ~= (S){10,10} ~ (S){1} ) { sout | s; } sout | endl;
+	sout | endl;
+	for ( s; (S){10,10} -~ (S){0} ) { sout | s; } sout | endl;
+	for ( s; (S){10,10} -~ (S){0} ~ (S){1} ) { sout | s; } sout | endl;
+	for ( s; (S){10,10} -~= (S){0} ) { sout | s; } sout | endl;
+	for ( s; (S){10,10} -~= (S){0} ~ (S){1} ) { sout | s; } sout | endl;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa loopctrl.c" //
+// End: //
