Index: uspace/dist/src/sysel/demos/arith.sy
===================================================================
--- uspace/dist/src/sysel/demos/arith.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/arith.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class ArithmeticDemo is
-	fun Main() is
+	fun Main(), static is
 		-- Test addition, multiplication and precedence.
 		Builtin.Write("2*2 + 2*2 = ");
@@ -88,5 +88,5 @@
 
 	-- Return factorial of n.
-	fun Factorial(n : int) : int is
+	fun Factorial(n : int) : int, static is
 		var i : int;
 		var val : int;
Index: uspace/dist/src/sysel/demos/array.sy
===================================================================
--- uspace/dist/src/sysel/demos/array.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/array.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class ArrayDemo is
-	fun Main() is
+	fun Main(), static is
 		var a : int[,];
 		var i : int;
Index: uspace/dist/src/sysel/demos/autobox.sy
===================================================================
--- uspace/dist/src/sysel/demos/autobox.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/autobox.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class AutoboxingDemo is
-	fun Main() is
+	fun Main(), static is
 		var b : Bool;
 		var c : Char;
@@ -51,5 +51,5 @@
 	end
 
-	fun foo(args : Object[], packed) is
+	fun foo(args : Object[], packed), static is
 	end
 end
Index: uspace/dist/src/sysel/demos/count.sy
===================================================================
--- uspace/dist/src/sysel/demos/count.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/count.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class CountDemo is
-	fun Count(a : int; b : int) is
+	fun Count(a : int; b : int), static is
 		var i : int;
 
@@ -39,5 +39,5 @@
 	end
 
-	fun Main() is
+	fun Main(), static is
 		Count(0, 10);
 	end
Index: uspace/dist/src/sysel/demos/ctor.sy
===================================================================
--- uspace/dist/src/sysel/demos/ctor.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/ctor.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class ConstructorDemo is
-	fun Main() is
+	fun Main(), static is
 		var a : A;
 
Index: uspace/dist/src/sysel/demos/deleg.sy
===================================================================
--- uspace/dist/src/sysel/demos/deleg.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/deleg.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class DelegateDemo is
-	fun Main() is
+	fun Main(), static is
 		var demo : DelegateClass;
 
Index: uspace/dist/src/sysel/demos/enum.sy
===================================================================
--- uspace/dist/src/sysel/demos/enum.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/enum.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class EnumDemo is
-	fun Main() is
+	fun Main(), static is
 		var color : ChessColor;
 
Index: uspace/dist/src/sysel/demos/except.sy
===================================================================
--- uspace/dist/src/sysel/demos/except.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/except.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,10 +28,10 @@
 
 class ExceptionDemo is
-	fun foo() is
+	fun foo(), static is
 	        Builtin.WriteLine("Entered foo().");
 		raise new BaseException();
 	end
 
-	fun Main() is
+	fun Main(), static is
 		do
 			foo();
Index: uspace/dist/src/sysel/demos/gen.sy
===================================================================
--- uspace/dist/src/sysel/demos/gen.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/gen.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -30,5 +30,5 @@
 
 class GenericsDemo is
-	fun Main() is
+	fun Main(), static is
 		Builtin.WriteLine("Let's try some generics.");
 
Index: uspace/dist/src/sysel/demos/hello.sy
===================================================================
--- uspace/dist/src/sysel/demos/hello.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/hello.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class HelloWorld is
-	fun Main() is
+	fun Main(), static is
 		Builtin.WriteLine("Hello world!");
 	end
Index: uspace/dist/src/sysel/demos/hexec.sy
===================================================================
--- uspace/dist/src/sysel/demos/hexec.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/hexec.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class HelenOSExecDemo is
-	fun Main() is
+	fun Main(), static is
 		Task.Exec("/app/tester");
 		Task.Exec("/app/tester", "print1");
Index: uspace/dist/src/sysel/demos/htxtfile.sy
===================================================================
--- uspace/dist/src/sysel/demos/htxtfile.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/htxtfile.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class TextFileDemo is
-	fun Main() is
+	fun Main(), static is
 		var name : string;
 		var line : string;
Index: uspace/dist/src/sysel/demos/iface.sy
===================================================================
--- uspace/dist/src/sysel/demos/iface.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
+++ uspace/dist/src/sysel/demos/iface.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -0,0 +1,87 @@
+--
+-- 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 InterfaceDemo is
+	fun Main(), static is
+		-- Create new instance of Foo
+		var f : Foo;
+		f = new Foo();
+
+		-- Variable of interface type
+		var g : IA/int;
+
+		-- Implicit conversion to interface implemented by Foo
+		g = f;
+
+		-- Explicit conversion of interface type IA/int to class type
+		-- Foo. Foo is implementing the interface IA/int.
+		f = g as Foo;
+
+		Builtin.WriteLine(g.a());
+	end
+end
+
+-- Generic interface implemented by class Foo
+interface IA/t is
+	fun a() : t;
+end
+
+-- Non-generic interface implemented by class Foo
+interface IB is
+	fun b();
+	prop P : int is
+		get;
+		set value;
+	end
+end
+
+-- Base class of Foo
+class A is
+end
+
+-- Class unrelated to Foo
+class B is
+end
+
+-- Foo is derived from A and implements IA/int and IB
+class Foo : A + IA/int + IB is
+	fun a() : int is
+		return 0;
+	end
+
+	fun b() is
+	end
+
+	prop P : int is
+		get is
+			return 1;
+		end
+		set value is
+		end
+	end
+end
Index: uspace/dist/src/sysel/demos/inherit.sy
===================================================================
--- uspace/dist/src/sysel/demos/inherit.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/inherit.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -43,5 +43,5 @@
 
 class InheritanceDemo is
-	fun Main() is
+	fun Main(), static is
 		var a : A;
 		var c : C;
Index: uspace/dist/src/sysel/demos/list.sy
===================================================================
--- uspace/dist/src/sysel/demos/list.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/list.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -29,5 +29,5 @@
 -- Using the List class from the library.
 class ListDemo is
-	fun Main() is
+	fun Main(), static is
 		var list : List/int;
 
@@ -39,10 +39,9 @@
 		list.Append(8);
 
-		var n : ListNode/int;
+		var e : IEnumerator/int;
 
-		n = list.First;
-		while n != nil do
-			Builtin.WriteLine(n.Data);
-			n = n.Next;
+		e = list.GetEnumerator();
+		while e.MoveNext() do
+			Builtin.WriteLine(e.Data);
 		end
 	end
Index: uspace/dist/src/sysel/demos/map.sy
===================================================================
--- uspace/dist/src/sysel/demos/map.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/map.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -29,5 +29,5 @@
 -- Using the Map class from the library.
 class MapDemo is
-	fun Main() is
+	fun Main(), static is
 		var map : Map/string/int;
 
@@ -39,8 +39,12 @@
 		map["four"] = 4;
 
-		Builtin.WriteLine(map["one"]);
-		Builtin.WriteLine(map["two"]);
-		Builtin.WriteLine(map["three"]);
-		Builtin.WriteLine(map["four"]);
+		var e : IEnumerator/string;
+
+		e = map.GetEnumerator();
+		while e.MoveNext() do
+			Builtin.Write(e.Data);
+			Builtin.Write(" -> ");
+			Builtin.WriteLine(map[e.Data]);
+		end
 	end
 end
Index: uspace/dist/src/sysel/demos/property.sy
===================================================================
--- uspace/dist/src/sysel/demos/property.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/property.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -98,5 +98,5 @@
 
 class PropertyDemo is
-	fun Main() is
+	fun Main(), static is
 		var a : Foo;
 		var i : int;
Index: uspace/dist/src/sysel/demos/string.sy
===================================================================
--- uspace/dist/src/sysel/demos/string.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/string.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 class StringDemo is
-	fun Main() is
+	fun Main(), static is
 		-- Concatenate some strings.
 		Builtin.WriteLine("One-" + "two-" + "three!");
Index: uspace/dist/src/sysel/demos/svar.sy
===================================================================
--- uspace/dist/src/sysel/demos/svar.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
+++ uspace/dist/src/sysel/demos/svar.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -0,0 +1,59 @@
+--
+-- 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 StaticPropertyDemo is
+	fun Main(), static is
+		-- Test static member variable
+		A.B.a = 1;
+		Builtin.WriteLine(A.B.a);
+		A.B.a = 2;
+		Builtin.WriteLine(A.B.a);
+
+		-- Test static property
+		A.B.P = 1;
+		Builtin.WriteLine(A.B.P);
+		A.B.P = 2;
+		Builtin.WriteLine(A.B.P);
+	end
+end
+
+class A is
+	class B is
+		var a : int, static;
+
+		prop P : int, static is
+			get is
+				return a;
+			end
+
+			set value is
+				a = value;
+			end
+		end
+	end
+end
Index: uspace/dist/src/sysel/demos/varargs.sy
===================================================================
--- uspace/dist/src/sysel/demos/varargs.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/demos/varargs.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -33,5 +33,5 @@
 	-- with the attribute 'packed'.
 	--
-	fun Print(args : string[], packed) is
+	fun Print(args : string[], packed), static is
 		var i : int;
 		var error : bool;
@@ -53,5 +53,5 @@
 	end
 
-	fun Main() is
+	fun Main(), static is
 		Print("One", "Two", "Three", "Four", "Five");
 	end
Index: uspace/dist/src/sysel/lib/arith.sy
===================================================================
--- uspace/dist/src/sysel/lib/arith.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/lib/arith.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -29,5 +29,5 @@
 class Arith is
 	-- Return factorial of n.
-	fun Factorial(n : int) : int is
+	fun Factorial(n : int) : int, static is
 		var i : int;
 		var val : int;
Index: uspace/dist/src/sysel/lib/boxed.sy
===================================================================
--- uspace/dist/src/sysel/lib/boxed.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/lib/boxed.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -38,8 +38,26 @@
 class Char is
 	var Value : char;
+
+	fun get_as_string() : string, builtin;
+
+	-- String representation.
+	prop AsString : string is
+		get is
+			return get_as_string();
+		end
+	end
 end
 
 class Int is
 	var Value : int;
+
+	fun get_as_string() : string, builtin;
+
+	-- String representation.
+	prop AsString : string is
+		get is
+			return get_as_string();
+		end
+	end
 end
 
Index: uspace/dist/src/sysel/lib/ienum.sy
===================================================================
--- uspace/dist/src/sysel/lib/ienum.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
+++ uspace/dist/src/sysel/lib/ienum.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -0,0 +1,41 @@
+--
+-- 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.
+--
+
+-- Enumerable collection interface.
+interface IEnumerable/tdata is
+	fun GetEnumerator() : IEnumerator/tdata;
+end
+
+-- Enumerator interface.
+interface IEnumerator/tdata is
+	fun MoveNext() : bool;
+
+	prop Data : tdata is
+		get;
+	end
+end
Index: uspace/dist/src/sysel/lib/libflist
===================================================================
--- uspace/dist/src/sysel/lib/libflist	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/lib/libflist	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -1,4 +1,5 @@
 arith.sy
 boxed.sy
+ienum.sy
 list.sy
 map.sy
Index: uspace/dist/src/sysel/lib/list.sy
===================================================================
--- uspace/dist/src/sysel/lib/list.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/lib/list.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -28,5 +28,5 @@
 
 -- Doubly-linked list.
-class List/t is
+class List/t : IEnumerable/t is
 	var head : ListNode/t;
 
@@ -59,6 +59,11 @@
 	prop First : ListNode/t is
 		get is
-		    return get_first();
+			return get_first();
 		end
+	end
+
+	-- Return first node in the list or @c nil if there is none.
+	fun GetEnumerator() : IEnumerator/t is
+		return new ListEnumerator/t(get_first());
 	end
 
@@ -131,4 +136,32 @@
 		end
 	end
+end
 
+class ListEnumerator/t : IEnumerator/t is
+	var first : ListNode/t;
+	var current : ListNode/t;
+	var started : bool;
+
+	new(first_node : ListNode/t) is
+		first = first_node;
+		current = nil;
+		started = false;
+	end
+
+	fun MoveNext() : bool is
+		if started then
+			current = current.Next;
+		else
+			current = first;
+			started = true;
+		end
+
+		return current != nil;
+	end
+
+	prop Data : t is
+		get is
+			return current.Data;
+		end
+	end
 end
Index: uspace/dist/src/sysel/lib/map.sy
===================================================================
--- uspace/dist/src/sysel/lib/map.sy	(revision 051bc69a7034999d45c93c61a56e515474aa78e3)
+++ uspace/dist/src/sysel/lib/map.sy	(revision 1113c9e130ee0cf71775a520394a8c7b73e1cf1e)
@@ -91,4 +91,8 @@
 		end
 	end
+
+	fun GetEnumerator() : IEnumerator/tkey is
+		return new MapEnumerator/tkey/tvalue(data.get_first());
+	end
 end
 
@@ -97,2 +101,31 @@
 	var Value : tvalue;
 end
+
+class MapEnumerator/tkey/tvalue : IEnumerator/tkey is
+	var first : ListNode/(MapPair/tkey/tvalue);
+	var current : ListNode/(MapPair/tkey/tvalue);
+	var started : bool;
+
+	new(first_node : ListNode/(MapPair/tkey/tvalue)) is
+		first = first_node;
+		current = nil;
+		started = false;
+	end
+
+	fun MoveNext() : bool is
+		if started then
+			current = current.Next;
+		else
+			current = first;
+			started = true;
+		end
+
+		return current != nil;
+	end
+
+	prop Data : tkey is
+		get is
+			return current.Data.Key;
+		end
+	end
+end
