Table of Contents Categories
  Encyclosphere.org ENCYCLOREADER
  supported by EncyclosphereKSF

SALSA (programming language)

From HandWiki - Reading time: 1 min

SALSA
ParadigmActor model
First appeared2001 (2001)
Stable release
1.1.5 / July 18, 2011; 13 years ago (2011-07-18)
Implementation languageJava
OScross-platform
Filename extensions.salsa
Websitehttp://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

Hello World

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

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





Licensed under CC BY-SA 3.0 | Source: https://handwiki.org/wiki/SALSA_(programming_language)
6 views | Status: cached on November 22 2024 01:23:31
↧ Download this article as ZWI file
Encyclosphere.org EncycloReader is supported by the EncyclosphereKSF