 					tokens.splice(i, 2, new CompiledConstant(OPERATOR_ESCAPE + token, operators[token]));
 				}
 			}
+			
+			// next step: combine 'for each' into a single token
+			if (tokens[0] == ST_EACH)
+				throw new Error("Invalid statement 'each'");
+			for (i = tokens.length; i > 0; i--)
+				if (tokens[i] == ST_EACH && tokens[i - 1] == ST_FOR)
+					tokens.splice(i - 1, 2, ST_FOR_EACH);
 			
 			// next step: compile unary '#' operators (except those immediately followed by other operators)
 			if (operators.hasOwnProperty('#'))

		 * This function will recursively compile a set of tokens into a compiled object representing a function that takes no parameters and returns a value.
		 * Example set of input tokens:  pow ( - ( - 2 + 1 ) ** - 4 , 3 ) - ( 4 + - 1 )
		 * @param tokens An Array of tokens for an expression.  This array will be modified in place.
		 * @param allowEmptyExpression If tokens is an empty Array, setting this to true will return an empty compiled object instead of throwing an error. 
		 * @return A CompiledConstant or CompiledFunctionCall generated from the tokens, or null if the tokens do not represent a valid expression.
		 */
		private function compileTokens(tokens:Array, allowEmptyExpression:Boolean):ICompiledObject
		{
			// there are no more parentheses, so the remaining tokens are operators, constants, and variable names.
			if (debug)

		private static const INDEX_TRUE:int = 1;
		private static const INDEX_FALSE:int = 2;
		
		private static const ST_IF:String = 'if';
		private static const ST_ELSE:String = 'else';
		
		private static const ST_FOR:String = 'for';
		private static const ST_EACH:String = 'each';
		private static const ST_FOR_EACH:String = 'for each';
		
		private static const ST_DO:String = 'do';
		private static const ST_WHILE:String = 'while';
		
		private static const ST_SWITCH:String = 'switch';
		private static const ST_CASE:String = 'case';
		private static const ST_DEFAULT:String = 'default';
		
		private static const ST_TRY:String = 'try';
		private static const ST_CATCH:String = 'catch';
		private static const ST_FINALLY:String = 'finally';
		
		private static const ST_BREAK:String = 'break';
		private static const ST_CONTINUE:String = 'continue';
		
		private static const ST_RETURN:String = 'return';
		private static const ST_THROW:String = 'finally';
		
		private static const _statementsWithoutParams:Array = [
			ST_ELSE, ST_DO, ST_BREAK, ST_CONTINUE, ST_CASE, ST_DEFAULT,
			ST_TRY, ST_FINALLY, ST_RETURN, ST_THROW
		];
		private static const _statementsWithParams:Array = [
			ST_IF, ST_FOR, ST_FOR_EACH, ST_WHILE, ST_SWITCH, ST_CATCH
		];

		private static const _PARAMS:String = 'PARAMS'; // must be enclosed in ()
		private static const _STMT:String = 'STMT'; // may contain multiple statements enclosed in {}
		private static const _EXPR:String = 'EXPR'; // may only contain one expression, optionally enclosed in (), no statements
		// longer patterns appear earlier so they will match before shorter patterns when checked in order
		private static const _validStatementPatterns:Array = [
			[ST_IF, _PARAMS, _STMT, ST_ELSE, _STMT],
			[ST_IF, _PARAMS, _STMT],
			[ST_FOR_EACH, _PARAMS, _STMT],
			[ST_FOR, _PARAMS, _STMT],
			[ST_DO, _STMT, ST_WHILE, _PARAMS],
			[ST_WHILE, _PARAMS, _STMT],
			[ST_TRY, _STMT, ST_CATCH, _PARAMS, _STMT, ST_FINALLY, _STMT],
			[ST_TRY, _STMT, ST_FINALLY, _STMT],
			[ST_TRY, _STMT, ST_CATCH, _PARAMS, _STMT],
			[ST_BREAK],
			[ST_CONTINUE],
			[ST_RETURN, _EXPR],
			[ST_RETURN],
			[ST_THROW, _EXPR]
		];

		/**
		 * (statement name):String -> (true if requires parentheses):Boolean
		 */
		private static var statements:Object = null;
		
		/**
		 * This is the prefix used for the function notation of infix operators.
