Lithe (programming language)

Lithe (programming language)

Lithe is an experimental programming language created in 1982 by David Sandberg at the University of Washington which allows the programmer to freely choose his own syntax. Lithe combines the ideas of syntax-directed translation and classes in a novel manner that results in a remarkably simple yet powerful language.

Overview

The standard class-based programming model does not specify a mechanism by which to manipulate objects: where Smalltalk uses message passing, Lithe uses syntax-directed translation (SDT). SDT is a method of translating a string into a sequence of "actions" by attaching on such action to each rule of a grammar. Thus, parsing a string of the grammar produces a sequence of rule applications. Lithe merges SDT with the class model by using classes as the non-terminal alphabet of the grammar. Since the grammar class used by Lithe properly contains all context-free grammars, a wide variety of syntax can be described, and SDT provides a simple way to attach semantics to any such syntax.

The "package" is the unit of program modularity in Lithe. A package is divided into two parts: one that defines classes and another that defines rules. Information hiding is achieved by requiring both "export" keywords on those rules and classes that are to be seen outside a package "and" that the source package names be included in the "with" clause of the consumer package.

Examples

Programming in Lithe consists of defining rule-action pairs and classes. Take the task of computing the absolute value of a number, for example:

rule "|" &lt;i:int> "|" return int; {if i<0 then return -i else return i end}

After this rule-action pair has been defined, it can be freely used within Lithe source code, for example, the following expression will thereafter be valid:

x - y| + 3

The equivalent rule in BNF would be:

&lt;int> ::= "|" <int> "|"

Note that the Lithe description swaps the left and right sides of the BNF one, then adds a name to each nonterminal in the BNF right-hand side. These names are used in the action part, which is expressed as a string that is translated into a sequence of actions by using other, previously defined, rule-action pairs (eventually, some of those rule-action pairs will invoke primitive actions).

External links

* [http://portal.acm.org/citation.cfm?id=582169 "Lithe: a language combining a flexible syntax and classes"]


Wikimedia Foundation. 2010.

Игры ⚽ Поможем решить контрольную работу

Look at other dictionaries:

  • Lithe — may refer to:* Lithe (programming language), an experimental programming language * Lithe (Middle earth), a fictional holiday in J. R. R. Tolkien s writings …   Wikipedia

  • List of programming languages — Programming language lists Alphabetical Categorical Chronological Generational The aim of this list of programming languages is to include all notable programming languages in existence, both those in current use and historical ones, in… …   Wikipedia

  • Liste des langages de programmation — Le but de cette Liste des langages de programmation est d inclure tous les langages de programmation existants, qu ils soient actuellement utilisés ou historiques, par ordre alphabétique. Ne sont pas listés ici les langages informatiques de… …   Wikipédia en Français

  • Accursed Lands — Infobox VG title = Accursed Lands MUD developer = Various engine = MudOS released = 1996 genre = MMORPG, MUD modes = Multiplayer platforms = OS Independent requirements = Telnet connectionAccursed Lands (AL) is a free MUD that has been online… …   Wikipedia

  • Media and Publishing — ▪ 2007 Introduction The Frankfurt Book Fair enjoyed a record number of exhibitors, and the distribution of free newspapers surged. TV broadcasters experimented with ways of engaging their audience via the Internet; mobile TV grew; magazine… …   Universalium

  • performing arts — arts or skills that require public performance, as acting, singing, or dancing. [1945 50] * * * ▪ 2009 Introduction Music Classical.       The last vestiges of the Cold War seemed to thaw for a moment on Feb. 26, 2008, when the unfamiliar strains …   Universalium

  • Damita Jo (album) — Damita Jo Studio album by Janet Jackson Released March 22, 2004 ( …   Wikipedia

  • RoboCop — For other uses, see RoboCop (disambiguation). RoboCop Theatrical release poster Directed by Paul Verhoeven …   Wikipedia

  • The Incredibles — Theatrical release poster Directed by Brad Bird Produced by …   Wikipedia

  • List of Pokémon (441–493) — Pokémon has 649 (as of Pokémon Black and White) distinctive fictional species classified as the titular Pokémon. These creatures and entities reside throughout various locations of the fictional Pokémon universe and can be caught by humans… …   Wikipedia

Share the article and excerpts

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