Sleep (programming language)

Sleep (programming language)

Infobox programming language
name = Sleep
logo =
paradigm = procedural, scripting
year = 2002
designer = Raphael Mudge
developer =
latest_release_version = 2.1
latest_release_date = release date|2008|07|01
latest_test_version =
latest_test_date =
typing = dynamic
implementations =
dialects =
influenced_by = Perl, Objective-C
operating_system = Cross platform (JVM)
license = LGPL
website = http://sleep.dashnine.org/

Sleep (as of "Simple Language for Environment Extension Purposes") is a procedural scripting language inspired by Perl and Objective-C. The only known implementation of the language is written in Java and is intended for embedding into existing Java applications to provide scripting services.

The Sleep Java API allows the language to be extended with new constructs, operators, functions, and variable containers, making it easy to integrate it into applications.

Sleep is currently utilized in the IRC client JIRCii and the IRC bot [http://www.ululatus.org/sleepybot/ SleepyBot] .

Status and History

Sleep first version appeared in a week-end of coding in April 2002. Since then Sleep has been developed in parallel with a Java IRC Client which heavily uses its features called [http://jirc.hick.org/jirc/ jIRCii] .The current stable 2.1 version is available since July 2008.

Overview

Sleep is very easy to learn in its basic form, and anyone familiar with Perl or PHP will feel right at home. In addition to being embeddable, Sleep can also be used stand-alone on the command line or using an interactive shell.

Language features

Data structures and types

Sleep has native support for three widely different data types: scalars, arrays, and hashes. Scalars are prefixed with a dollar sign ($), arrays with 'at'-signs (@) and hashes with percentage signs (%).

* Scalars represent either a string, or a number. Strings can be specified in run-time as literals or as parsed literals. Numbers are either integers, or floating point. Scalars can also contain references to objects when utilizing the HOES subsystem.
* Arrays are a collection of scalars, hashes or other arrays referenced by an index number, starting at 0.
* Hashes are similar to arrays, but maps keys to values. Keys can be both strings and numbers.

Dynamic typing

Sleep is a dynamically typed language. This means that variables don't have to be declared, or typed, before being used. There are certain advantages to this, and also certain disadvantages.

Input/output

Included in Sleep is support for basic input/output. This includes reading and writing from/to files and sockets.

Serialization

Parsed [http://sleep.hick.org Sleep] scripts can be serialized and saved to disk. This means faster execution of scripts since the script interpreter can skip the parser and scanner steps.

HOES

HOES is a feature that lets the scripter manipulate Java objects using a syntax similar to Objective-C. Objects and primitives can be referenced via ordinary Sleep scalars.

Easy integration

Sleep is integrated into Java applications using the concept of "programmatical bridges". These bridges act as a proxy between the Sleep scripts and the application they're run for. Bridges are written in Java, and there is extensive documentation and tutorials on how to write them.

Sleep supports the following bridge types:
* Loadable bridges
* Function bridges
* Operator bridges
* Predicates bridges
* Evaluation bridges
* Variable bridges
* Environment bridges
* Filtered environment bridges
* Predicate environment bridges

Bridges can also act as "modules", as in expanding the API available to the scripts. For example, a JDBC module is underway, providing advanced database connectivity to Sleep scripters. Several other similar modules are also being planned to expand Sleep with XML/XSLT capabilities, improved sockets with support for UDP, Swing GUI, and more.

Applications

Sleep is currently being used actively in the following applications:
* [http://jircii.hick.org jIRCii]
* [http://www.ululatus.org/sleepybot/ SleepyBot]

Examples

This example outputs the text "Hello world!":

# This example outputs "Hello world!" to stdout println("Hello World!");

Another more complex example:

# Usage: format(subject, repl1, repl2, ...,); # Example: format('a {0} c', 'b'); # returns 'a b c' sub format { local('$subject @args $idx $match'); @args = @_; $subject = removeAt(@args, 0); foreach $i => $arg (@args) { $match = '{' . $i . '}'; $subject = strrep($subject, $match, $arg); } return $subject; }

External links

* [http://sleep.dashnine.org/ Sleep home page]


Wikimedia Foundation. 2010.

Игры ⚽ Нужно сделать НИР?

Look at other dictionaries:

  • Programming language — lists Alphabetical Categorical Chronological Generational A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that… …   Wikipedia

  • Oxygene (programming language) — Oxygene Developer RemObjects Software Stable release 3.0.21 (August 29, 2009; 2 years ago (2009 08 29)) Influenced by Object Pas …   Wikipedia

  • Boo (programming language) — Infobox programming language name = Boo paradigm = Object oriented year = 2003 designer = Rodrigo B. De Oliveira developer = Rodrigo B. De Oliveira latest release version = 0.8.2 latest release date = 2008 05 20 typing = static, strong, duck… …   Wikipedia

  • Sleep (disambiguation) — Sleep is a form of rest.Sleep can also refer to:* The material found in the corner of one s eye upon waking, which is a normal buildup of tears, mucus, and dirt that appears at the edge of the eyelids after sleep, otherwise known as rheum and… …   Wikipedia

  • Welsh language — Welsh Cymraeg, y Gymraeg Pronunciation [kəmˈrɑːɨɡ] Spoken in   …   Wikipedia

  • Concordia Language Villages — Address 901 8th St. S. Moorhead, MN, 56562 United States Information Motto to prepare young people for responsible citizenship in our global community Deno …   Wikipedia

  • JIRCii — Infobox Software name = jIRCii caption = developer = released = ? latest release version = Beta 44 latest release date = August 7, 2008 programming language = Java 1.4.2+ / Sleep 2.1 operating system = Cross platform language = English genre =… …   Wikipedia

  • PIC microcontroller — PIC microcontrollers in DIP and QFN packages …   Wikipedia

  • Mac OS X Snow Leopard — Mac OS X v10.6 Snow Leopard Part of the Mac OS X family …   Wikipedia

  • SystemVerilog DPI — (Direct Programming Interface) is an interface which can be used to interface SystemVerilog with foreign languages. These Foreign languages can be a C, C++, System C as well as others. DPI s consists of two layers: A SystemVerilog Layer and a… …   Wikipedia

Share the article and excerpts

Direct link
Do a right-click on the link above
and select “Copy Link”