SALSA (programming language)

From Wikipedia, the free encyclopedia
  (Redirected from SALSA programming language)
Jump to: navigation, search
SALSA
Paradigm Actor model
First appeared 2001 (2001)
Stable release 1.1.5 / July 18, 2011; 4 years ago (2011-07-18)
Implementation language Java
OS cross-platform
Filename extensions .salsa
Website http://wcl.cs.rpi.edu/salsa/

The SALSA programming language (Simple Actor Language System and Architecture) is an actor-oriented programming language that uses concurrency primitives beyond asynchronous message passing, including token-passing, join, and first-class continuations. It also supports distributed computing over the Internet with universal naming, remote communication, and migration linguistic abstractions and associated middleware. For portability, it produces Java code.

Examples[edit]

Hello World[edit]

module demo;

 
/*
   This behavior simply sends two print(...) messages to the
   standardOutput actor.
*/

behavior HelloWorld {
   /*
      The act(...) message handler is invoked by stand-alone
      theaters automatically and is used to bootstrap salsa
      programs.
   */

   void act( String[] argv ) {

      standardOutput<-print( "Hello" ) @

      standardOutput<-print( "World!" );

   }
   /*
      Notice that the above code is different from
         standardOutput<-print( "Hello" );
         standardOutput<-print( "World!" );
      the code above uses a continuation to insure that the
      world message is sent after the hello message
      completes processing.
   */

}

Standard Input[edit]

module demo;

 
/*
   This behavior simply prints out a string,
   reads a line from the Standard Input,
   combines the return value of the Standard Input with other strings,
   and then prints out the combined string.
*/

behavior StandardInputTest{

   public StandardInputTest() {}

   String mergeString(String str1, String str2, String str3) {
       return str1+str2+str3;
    }

   void act(String[] args) {
      standardOutput<-println("What's your name?")@
      standardInput<-readLine()@
      self<-mergeString("Hi, ",token, ". Nice to meet you!" )@
      standardOutput<-println(token);
   }
}

External links[edit]