Oberon-2 Programming is an version of Oberonn programming laguge which has additional featuers then oberons.The additional features of Oberon-2 are limited reflection and object oriented programming facilities,reintroduction of FOR Loop from Module-2 and open arrays as pointer base types.It was developed by Niklaus Wirth and Hanspeter Mössenböck in 1991.It is influed by many languages like Pascal,Module-2,Oberon etc.
MODULE Lists; (*** declare global constants, types and variables ***) TYPE List* = POINTER TO ListNode; ListNode = RECORD value : Integer; next : List; END; (*** declare procedures ***) PROCEDURE (l : List) Add* (v : Integer); BEGIN IF l = NIL THEN NEW(l); (* create record instance *) l.value := v ELSE l.next.Add(v) (* recursive call to .add(n) *) END END Add; PROCEDURE (l : List) Get* () : Integer; VAR v : Integer; BEGIN IF l = NIL THEN RETURN 0 (* .get() must always return an INTEGER *) ELSE v := l.value; (* this line will crash if l is NIL *) l := l.next; RETURN v END END Get; END Lists.
Assignment Writing Help
Engineering Assignment Services
Do My Assignment Help
Write My Essay Services