Abstract
OUN (Oslo University Notation)is developed at the University of Oslo. It is a formal notation intended to be easier to understand and use. It is adjusted to support the development of distributed systems.
In the rst part of this thesis, we have found the principles of translation from OUN to Java. In OUN all objects are active, they execute their own methods, even if other objects calls them. To solve that, all objects in the generated Java code runs in its own thread. These objects have a queue of calls, where calls are taken and methods are executed. Return values are put back in a queue of return values in the caller's object. When the queue of calls is empty, the object will fall asleep. We save processing time, when not having to poll on the queue. When an object wants a method in another object executed, it puts a call into the queue of calls, and wakes the object. If the method has return values, the caller will have to wait for them. It falls asleep, and is wakened by the object running the method after the return values is placed in the queue of return values. We have considered several ways of implementing this. Even though OUN and Java are quite similar, they have important differences. It has not been possible to find a perfect solution. We have prioritized to choose solutions similar to the principles of OUN.
In the second part of the thesis, we have built a compiler for the translation. We have continued to build on the syntax checker already built in JavaCC. That is a tool for automatic generation of syntax checkers. We ran the grammar file through JJTree to build up a syntax tree. It generates a class for every non-terminal in the language. The nodes are linked together to form a tree. In every node we added a method to translate the code. After the syntax is checked, we now can translate the OUN code by calling the added method in the root of the tree. Code is generated by traversing down the tree from the root.
Semantic check of OUN is not yet added, and we have no symbol table
implemented. In this version of the compiler, we therefore had to put some limitations on the functionality of OUN.