Easy Mobile Programming

Easy-to-use programming language for developing independent Symbian OS applications

Introduction to the EMP language

The EMP language is designed to be an easy-to-use programming language for developing independent Symbian OS applications. Currently it is a prototype, so it can't be used for serious programming. Nevertheless it can be used for creating working Symbian applications such as simple games. In this article I'll give a quick introduction to the EMP language.

The EMP project

The EMP language and EMP compiler is the result of my Master's thesis and Master's project in the University of Kuopio. EMP project is an open source project and the EMP compiler is published under the GPL licence.

These are the reasons why I thought that a new easy-to-use alternative for Symbian OS C++ would be needed:

The main difference between Symbian OS C++ and the EMP language is that the EMP language is not an all-purpose-language. The EMP language is designed only for developing Symbian OS applications, which uses the Symbian OS Application Framework. This gives an opportunity to provide the programmer with a simpler language in which he only have to concentrate on specific aspects of the application he is currently working with.

EMP language also encapsulates difficult concepts of the Symbian OS C++ and provides a simpler interface for the programmer. For example with EMP language programmers doesn't have to learn how to use CleanupStack or Descriptors.

Application structure

The core of the EMP application is procedural (The support for object oriented programming might be included in the future). EMP application consists of an Application block (see listing 1) and View blocks (see listing 2) (please note that in the current version of the EMP language you can only use one view).

Application HelloWorld
		UId = 0x10005C41 
		Defaultview = HelloView
Listing 1. A simple Application block

The Application block in the listing 1 defines all the required properties of the EMP application: the application name (HelloWorld), Unique Identifier (0x10005C41) and the default view (HelloView). There could be other sub blocks in the Application block such as Variables, Init, methods and sub blocks for handing key events (OnKeyDown, OnKeyUp or OnKeyPress).

View HelloView
		DrawText("Hello World", 10, 10)
Listing 2. A view that writes "Hello World" to the screen

The View block in the listing 2 defines a View that writes "Hello World" to the screen. That is done by defining the Draw sub block containing a DrawText statement. Same as the Application block the View block could contain more sub blocks (see listing 3).

A quick look on the syntax

The first thing you might notice from the syntax is that in the EMP language blocks are separated with indentations and statements are separated with end-of-line-characters (or with dedentation in the case of a structured statement). Similar technique is used for example in the Python language.

In listing 3 you can see a little more complex application that bounces a bitmap up and down on the screen.

View AnimatedBitmap
		int y
		Bitmap ball
		boolean down
		Refreshrate = 10 //ms

		y = 0
		/*Load a bitmap
		and store it to the ball variable*/
		ball = LoadBitmap("ball.bmp") 

		DrawBitmap(ball, 100, y)

		if (down and y>100)
		else if (not down and y<10)

		if (down)
			y += 10
			y -= 10
Listing 3. A view that draws a moving bitmap to the screen

The View in listing 3 has five sub blocks: Variables, Properties, Init, Draw and a method called MoveBall(). Variables block contains Views variable declarations. Properties block defines refreshrate property that tells how often the screen is redrawn. Init block contains initialization code. Draw block is called every time the screen gets refreshed. MoveBall block defines a simple method that has no return value or parameters.

For further information about the syntax, see the syntax defition.

Language Extensions

Data types (e.g. int, real and Bitmap) and a part of the statements (e.g. DrawBitmap, DrawText and DrawMaskedBitmap) of the EMP language are defined in external XML files.

Currently this part of the EMP language is incomplete and only simple statements or data types can be implemented.

The EMP compiler

EMP compiler was my Master's project and it implements the prototype of the EMP language. The compiler generates Symbian OS C++ code, which is then compiled with the Symbian OS SDKs compilers to the machine language (I got this idea when I red that Stroustrup implemented C++ with a compiler that generated C code).

EMP compiler uses xml files for generating a basic structure of the Symbian OS C++ applications. Every source code file has its own template, which contains the basic structure the file and a part of the target code. The benefit from this approach is that porting EMP language to different platforms is easier when you only have to create new versions of the existing XML files. At this moment there are XML files only for Series 60 1st edition.

Because the EMP compiler generates Symbian OS C++ one might get the impression that EMP compiler is a preprocessor, but that is not the case. Scott [Sco02] tries to correct this misuse of the term. He stated that compilers attempt to "understand" their source; preprocessors do not.

The future of the EMP project

So far I have mainly concentrated on the simpler application structure. There are three main areas for further research and development: UI programming, the support for Object Oriented paradigm and language extensions (possibly with XML files).

Right now the future of the EMP language mostly depends on getting the funding for further research and development.


[Sco02] Scott M. L.: Programming language pragmatics. Morgan Kaufmann, San Francisco, CA, 2000.