Index: uspace/dist/src/sysel/demos/arith.sy
===================================================================
--- uspace/dist/src/sysel/demos/arith.sy	(revision 0a72efcb56c11bc14200cc2b33ba2af13610c8c7)
+++ uspace/dist/src/sysel/demos/arith.sy	(revision 0a72efcb56c11bc14200cc2b33ba2af13610c8c7)
@@ -0,0 +1,101 @@
+--
+-- Copyright (c) 2010 Jiri Svoboda
+-- All rights reserved.
+--
+-- Redistribution and use in source and binary forms, with or without
+-- modification, are permitted provided that the following conditions
+-- are met:
+--
+-- o Redistributions of source code must retain the above copyright
+--   notice, this list of conditions and the following disclaimer.
+-- o Redistributions in binary form must reproduce the above copyright
+--   notice, this list of conditions and the following disclaimer in the
+--   documentation and/or other materials provided with the distribution.
+-- o The name of the author may not be used to endorse or promote products
+--   derived from this software without specific prior written permission.
+--
+-- THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+-- IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+-- OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+-- IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+-- INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+-- NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-- DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-- THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+-- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+--
+
+class ArithmeticDemo is
+	fun Main() is
+		-- Test addition, multiplication and precedence.
+		Builtin.WriteLine("2*2 + 2*2 =");
+		Builtin.WriteLine(2*2 + 2*2);
+		Builtin.WriteLine("(expected: 8)");
+
+		-- Test subtraction, multiplication and precedence.
+		Builtin.WriteLine("1111 - 1 - 10 - 10*10 - 10*10*10 =");
+		Builtin.WriteLine(1111 - 1 - 10 - 10*10 - 10*10*10);
+		Builtin.WriteLine("(expected: 0)");
+
+		-- Test parenthesized sub-expressions.
+		Builtin.WriteLine("10 * (1 - 1) =");
+		Builtin.WriteLine(10 * (1 - 1));
+		Builtin.WriteLine("(expected: 0)");
+
+		-- Test unary plus and minus.
+		Builtin.WriteLine("(+1) - (-1) - (+(+1)) + (+(-1)) = ");
+		Builtin.WriteLine((+1) - (-1) - (+(+1)) + (+(-1)));
+		Builtin.WriteLine("(expected: 0)");
+
+		-- Test signed multiplication.
+		Builtin.WriteLine("+1 * +1 = ");
+		Builtin.WriteLine(+1 * +1);
+		Builtin.WriteLine("(expected: 1)");
+		Builtin.WriteLine("-1 * -1 = ");
+		Builtin.WriteLine(-1 * -1);
+		Builtin.WriteLine("(expected: 1)");
+		Builtin.WriteLine("+1 * -1 = ");
+		Builtin.WriteLine(+1 * -1);
+		Builtin.WriteLine("(expected: -1)");
+		Builtin.WriteLine("-1 * +1 = ");
+		Builtin.WriteLine(-1 * +1);
+		Builtin.WriteLine("(expected: -1)");
+
+		-- Test multiplication with large result.
+		Builtin.WriteLine("1000000 * 1000000 * 1000000 * 1000000 =");
+		Builtin.WriteLine(1000000 * 1000000 * 1000000 * 1000000);
+		Builtin.WriteLine("(expected: 1000000000000000000000000)");
+
+		-- Test large literals.
+		Builtin.WriteLine("1000000000000000000000000 =");
+		Builtin.WriteLine(1000000000000000000000000);
+		Builtin.WriteLine("(expected: 1000000000000000000000000)");
+
+		-- Test large factorials.
+		var n : int;
+
+		Builtin.WriteLine("Factorials:");
+		n = 1;
+		while n <= 40 do
+			Builtin.WriteLine(Factorial(n));
+			n = n + 1;
+		end
+	end
+
+	-- Return factorial of n.
+	fun Factorial(n : int) : int is
+		var i : int;
+		var val : int;
+
+		i = 1;
+		val = 1;
+
+		while i <= n do
+			val = val * i;
+			i = i + 1;
+		end
+
+		return val;
+	end
+end
Index: uspace/dist/src/sysel/demos/varargs.sy
===================================================================
--- uspace/dist/src/sysel/demos/varargs.sy	(revision 9f10660f34e7fc98fc93338eaf64f0d8bd82da7a)
+++ uspace/dist/src/sysel/demos/varargs.sy	(revision 0a72efcb56c11bc14200cc2b33ba2af13610c8c7)
@@ -33,13 +33,20 @@
 	-- with the attribute 'packed'.
 	--
-	-- Note that we need to pass 'n' just because the array type
-	-- does not implement the Length property yet.
-	--
-	fun Print(n : int; args : string[], packed) is
+	fun Print(args : string[], packed) is
 		var i : int;
+		var error : int;
 
+		error = 0;
 		i = 0;
-		while i < n do
-			Builtin.WriteLine(args[i]);
+		while error == 0 do
+			-- This is definitely the wrong way to determine
+			-- array bounds, but until a better one is
+			-- implemented...
+			do
+				Builtin.WriteLine(args[i]);
+			except e : Error.OutOfBounds do
+				error = 1;
+			end
+
 			i = i + 1;
 		end
@@ -47,5 +54,5 @@
 
 	fun Main() is
-		Print(5, "One", "Two", "Three", "Four", "Five");
+		Print("One", "Two", "Three", "Four", "Five");
 	end
 end
