Friday, October 5, 2012

Let's do the LIMBO




The Limbo Programming Language


I.                    Introduction
Limbo is a programming language intended for applications running distributed systems on small computers. It supports modular programming, strong type checking at compile and run-time, inter-process communication over typed channels, automatic garbage collection, and simple data types. It is designed for safe execution even on small machines without hardware memory protection.

In its initial implementation for the Inferno operating system, object programs generated by the Limbo compiler run using the interpreter for a fixed virtual machine. Inferno and its accompanying virtual machine run either stand-alone on bare hardware or as an application under conventional operating systems like Unix, Windows 95, Windows NT and Plan 9.

II.                  Programming Language Overview
Limbo have similarities to JAVA, this was produced by Sean Doward, Phil Winterbottom and Rob Pike. It is similar not only in terms of its strong typing, dynamic loading, automatic garbage collection, but also it compiles a program into a machine independent byte code for execution on a virtual machine.

Limbo program is a set of modules that cooperate to perform a task that was intended to be used in Inferno, which emphasizes networking and graphical interfaces.

a.       Modules
A module consists of a module declaration that specifies the public interface, the functions, abstract data types, and constants that the module makes visible to other module and an implementation that provides the actual code.

b.      Functions and Variables
Functions are associated with specific modules, either directly or as members of abstract data types within a module. Functions are visible outside their module only if they are part of the module interface.

c.       Data Types
Limbo provides abstract data types such as byte, int, big and real. It also provides Unicode strings, arrays of arbitrary types, lists of arbitrary types, tuples, reference types and typed channels. It provides automatic garbage collection, so there is no nedd to free dynamically created objects.

d.      Operators and Expression
Limbo provides many operators that are used in C programming language, but there is no ?: operator,  and ++ and – can only be postfix. Pointers created with ref, are very restricted and there is no &(address of) operator; there is no address arithmetic and pointers can only point to adt objects. Array slicing is supported, however, and replaces many pointer constructions.

e.      Statements
Statements and control flow in Limbo are similar in those in C. There is also case statement analogous to switch in C. A break or continue as well as the exit statement is also used. Comments in Limbo begin with # and extend until the end of the line.

f.        Libraries
This programming language has a small but still growing set of standard libraries, each implemented as a module.

III.                Features
a.       Exception Handler
Various errors in Limbo program can be detected only at run time. These include programming errors such as an attempt to index outside the bounds of an array, system errors such as exhausting memory, and user-defined exceptions declared at compile-time by exception declaration and caused at run-time by the raise statement.

b.      Scope
  The scope of an identifier is the lexical range of a program throughout which the identifier means a particular type of, or instance of, an object. the same identifier may be associated with several different objects in different parts of the same program

c.       Type Equality and Compatibility
  In an assignment and in passing an actual argument to a function, the types of the target and the expression being assigned or passed must be equal (with certain exceptions, e.g. assignment of nil to a referenced type).

d. Forward Referencing
   In general, names must be declared before they are used. the first exception to this rule is that a function local to a module need not have a declaration at all; it is sufficient to give its definition, and that definition may appear anywhere in the module.

IV.                Sample Codes

Hello World Program in Limbo  
       
implement Command;
include “sys.m”;
    sys: Sys;                          
include “draw.m”;
include “sh.m”;
init (nil: ref Draw -> Context nil: list of string)
{
    sys = load Sys Sys-> PATH;
    sys->print(“Hello World! \n”);
}


V.                  References

VI.                Members
     Email Address: cmsc124.t5l.limbo@gmail.com
     CMSC 124 (T-5L)
  •      2010-28910 ALIGORA, Jerome Oliver R. 
  •      2010-43728 ALMONTE, Joseph Conrad N.
  •      2010-61438 ARTANA, Jayson A.
  •      2010-27006 MENDOZA, Rinno Adam P.

1 comment: