Index: uspace/dist/src/sysel/demos/ctor.sy
===================================================================
--- uspace/dist/src/sysel/demos/ctor.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
+++ uspace/dist/src/sysel/demos/ctor.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -0,0 +1,46 @@
+--
+-- 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 ConstructorDemo is
+	fun Main() is
+		var a : A;
+
+		a = new A(1);
+		Builtin.Write("a.v = ");
+		Builtin.WriteLine(a.v);
+	end
+end
+
+class A is
+	var v : int;
+
+	new(i : int) is
+		Builtin.WriteLine("A.new()");
+		v = i;
+	end
+end
Index: uspace/dist/src/sysel/demos/enum.sy
===================================================================
--- uspace/dist/src/sysel/demos/enum.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
+++ uspace/dist/src/sysel/demos/enum.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -0,0 +1,92 @@
+--
+-- 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 EnumDemo is
+	fun Main() is
+		var color : ChessColor;
+
+		Builtin.WriteLine("Set color to ChessColor.Black.");
+		color = ChessColor.Black;
+
+		Builtin.Write("Test color == ChessColor.Black.. ");
+		if color == ChessColor.Black then
+			Builtin.WriteLine("True - OK");
+		else
+			Builtin.WriteLine("False - Fail!");
+			raise new Error.Base();
+		end
+
+		Builtin.Write("Test color != ChessColor.Black.. ");
+		if color != ChessColor.Black then
+			Builtin.WriteLine("True - Fail!");
+			raise new Error.Base();
+		else
+			Builtin.WriteLine("False - OK");
+		end
+
+		Builtin.Write("Test color == ChessColor.White.. ");
+		if color == ChessColor.White then
+			Builtin.WriteLine("True - Fail!");
+			raise new Error.Base();
+		else
+			Builtin.WriteLine("False - OK");
+		end
+
+		Builtin.Write("Test color != ChessColor.White.. ");
+		if color != ChessColor.White then
+			Builtin.WriteLine("True - OK");
+		else
+			Builtin.WriteLine("False - Fail!");
+			raise new Error.Base();
+		end
+
+		Builtin.WriteLine("Success");
+
+		-- Test enum declared in non-CSI scope
+
+		var ptype : ChessPiece;
+
+		ptype = ChessPiece.King;
+	end
+
+	-- Enumerated type declared inside a class
+	enum ChessColor is
+		White;
+		Black;
+	end
+end
+
+-- Enumerated type declared outside any class
+enum ChessPiece is
+	King;
+	Queen;
+	Bishop;
+	Knight;
+	Rook;
+	Pawn;
+end
Index: uspace/dist/src/sysel/demos/htxtfile.sy
===================================================================
--- uspace/dist/src/sysel/demos/htxtfile.sy	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/demos/htxtfile.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -43,5 +43,5 @@
 		out_file.OpenWrite("/out.txt");
 
-		while in_file.EOF != 1 do
+		while not in_file.EOF do
 			line = in_file.ReadLine();
 			Builtin.WriteLine(name + ": " + line);
Index: uspace/dist/src/sysel/demos/list.sy
===================================================================
--- uspace/dist/src/sysel/demos/list.sy	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/demos/list.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -33,5 +33,4 @@
 
 		list = new List/int();
-		list.Init();
 
 		list.Append(5);
@@ -44,5 +43,5 @@
 		n = list.First;
 		while n != nil do
-			Builtin.WriteLine(n.Value);
+			Builtin.WriteLine(n.Data);
 			n = n.Next;
 		end
Index: uspace/dist/src/sysel/demos/map.sy
===================================================================
--- uspace/dist/src/sysel/demos/map.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
+++ uspace/dist/src/sysel/demos/map.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -0,0 +1,46 @@
+--
+-- 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.
+--
+
+-- Using the Map class from the library.
+class MapDemo is
+	fun Main() is
+		var map : Map/string/int;
+
+		map = new Map/string/int();
+
+		map["one"] = 1;
+		map["two"] = 2;
+		map["three"] = 3;
+		map["four"] = 4;
+
+		Builtin.WriteLine(map["one"]);
+		Builtin.WriteLine(map["two"]);
+		Builtin.WriteLine(map["three"]);
+		Builtin.WriteLine(map["four"]);
+	end
+end
Index: uspace/dist/src/sysel/demos/string.sy
===================================================================
--- uspace/dist/src/sysel/demos/string.sy	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/demos/string.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -39,4 +39,6 @@
 			i = i + 1;
 		end
+
+		Builtin.WriteLine("Abracadabra".Slice(2, 4));
 	end
 end
Index: uspace/dist/src/sysel/demos/varargs.sy
===================================================================
--- uspace/dist/src/sysel/demos/varargs.sy	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/demos/varargs.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -35,9 +35,9 @@
 	fun Print(args : string[], packed) is
 		var i : int;
-		var error : int;
+		var error : bool;
 
-		error = 0;
+		error = false;
 		i = 0;
-		while error == 0 do
+		while not error do
 			-- This is definitely the wrong way to determine
 			-- array bounds, but until a better one is
@@ -46,5 +46,5 @@
 				Builtin.WriteLine(args[i]);
 			except e : Error.OutOfBounds do
-				error = 1;
+				error = true;
 			end
 
Index: uspace/dist/src/sysel/lib/boxed.sy
===================================================================
--- uspace/dist/src/sysel/lib/boxed.sy	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/lib/boxed.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -46,3 +46,15 @@
 class String is
 	var Value : string;
+
+	fun get_length() : int, builtin;
+
+	-- Length of string.
+	prop Length : int is
+		get is
+			return get_length();
+		end
+	end
+
+	-- Slice (sub-string).
+	fun Slice(start : int; length : int) : string, builtin;
 end
Index: uspace/dist/src/sysel/lib/libflist
===================================================================
--- uspace/dist/src/sysel/lib/libflist	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/lib/libflist	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -2,2 +2,3 @@
 boxed.sy
 list.sy
+map.sy
Index: uspace/dist/src/sysel/lib/list.sy
===================================================================
--- uspace/dist/src/sysel/lib/list.sy	(revision 38aaacc20a85af2361a0240ac2e7d643e086ecfa)
+++ uspace/dist/src/sysel/lib/list.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -31,6 +31,6 @@
 	var head : ListNode/t;
 
-	-- Initialize list.
-	fun Init() is
+	-- New empty list.
+	new() is
 		head = new ListNode/t();
 		head.prev = head;
@@ -46,5 +46,5 @@
 
 		n = new ListNode/t();
-		n.value = data;
+		n.data = data;
 
 		n.prev = ntl;
@@ -74,5 +74,5 @@
 
 class ListNode/t is
-	var value : t;
+	var data : t;
 
 	var prev : ListNode/t;
@@ -80,8 +80,8 @@
 	var head : ListNode/t;
 
-	-- Value stored in this node.
-	prop Value : t is
+	-- Data stored in this node.
+	prop Data : t is
 		get is
-			return value;
+			return data;
 		end
 	end
@@ -99,4 +99,17 @@
 			return get_next();
 		end
+	end
+
+	-- Remove node from list.
+	fun Remove() is
+		var p : ListNode/t;
+		var n : ListNode/t;
+
+		p = prev; n = next;
+		p.next = n;
+		n.prev = p;
+
+		prev = nil;
+		next = nil;
 	end
 
Index: uspace/dist/src/sysel/lib/map.sy
===================================================================
--- uspace/dist/src/sysel/lib/map.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
+++ uspace/dist/src/sysel/lib/map.sy	(revision 640ffe664a867642b35d372f9cf26c5898381793)
@@ -0,0 +1,98 @@
+--
+-- 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.
+--
+
+-- Trivial map.
+class Map/tkey/tvalue is
+	var data : List/(MapPair/tkey/tvalue);
+
+	-- New empty map.
+	new() is
+		data = new List/(MapPair/tkey/tvalue)();
+	end
+
+	fun Set(key : tkey; value : tvalue) is
+		if KeyPresent(key) then
+			Remove(key);
+		end
+
+		var p : MapPair/tkey/tvalue;
+		p = new MapPair/tkey/tvalue();
+
+		p.Key = key;
+		p.Value = value;
+		data.Append(p);
+	end
+
+	-- Return internal list node associated with key @a key.
+	fun lookup_node(key : tkey) : ListNode/(MapPair/tkey/tvalue) is
+		var node : ListNode/(MapPair/tkey/tvalue);
+
+		node = data.First;
+		while node != nil do
+			if node.Data.Key == key then
+				return node;
+			end
+
+			node = node.Next;
+		end
+
+		return nil;
+	end
+
+	fun KeyPresent(key : tkey) : bool is
+		return lookup_node(key) != nil;
+	end
+
+	fun Get(key : tkey) : tvalue is
+		var node : ListNode/(MapPair/tkey/tvalue);
+
+		node = lookup_node(key);
+		return node.Data.Value;
+	end
+
+	fun Remove(key : tkey) is
+		var node : ListNode/(MapPair/tkey/tvalue);
+
+		node = lookup_node(key);
+		node.Remove();
+	end
+
+	prop self[key : tkey] : tvalue is
+		get is
+			return Get(key);
+		end
+		set value is
+			Set(key, value);
+		end
+	end
+end
+
+class MapPair/tkey/tvalue is
+	var Key : tkey;
+	var Value : tvalue;
+end
