Factor (programming language)

Factor (programming language)

Infobox programming language
name = Factor

paradigm = stack-based
year = 2003
developer = Slava Pestov
latest_release_version = Continuous Builds [http://factorcode.org/binaries.fhtml]
typing = strong, dynamic
influenced_by = Joy, Forth, Lisp, Self
influenced = Cat
operating_system = Windows, Mac OS, Linux, others
license = BSD license
website = [http://factorcode.org/ factorcode.org]

Factor is a dynamically typed concatenative programming language whose design and implementation is led by Slava Pestov. Factor's main influences are Joy, Forth, Lisp and Self. Current versions of Factor exist as Continuous Builds for supported platforms while version 1.0 is under development [http://factorcode.org/binaries.fhtml] . A 1.0 release is planned in 2008.

Like other concatenative languages, Factor has a postfix syntax, meaning that you write the arguments of a function before its name. As an example, Hello world in Factor is "Hello world" print

Factor is dynamically typed, and a unique object system accompanies it. In Factor, there is a small group of base types, and users and the standard library can make their own classes using tuples and other mechanisms. Factor supports inheritance. Additionally, there are other ways to make classes other than types or tuples; Factor supports predicate classes and union classes. Factor's built-in compound datatypes include fixed and variable length vectors and hashtables. The language also supports floating point, and arbitrary precision integers. Linked lists, complex numbers and fractions are implemented in the standard library.

Factor was originally only interpreted, but is now fully compiled (the non-optimizing compiler basically unrolls the interpreter loop [ [http://factor-language.blogspot.com/2007/09/two-tier-compilation-comes-to-factor.html Factor: a practical stack language: Two-tier compilation comes to Factor ] ] [ [http://factor-language.blogspot.com/2008/01/compiler-overhaul.html Factor: a practical stack language: Compiler overhaul ] ] ). The optimizing machine code compiler is written entirely in Factor. It does not output standalone executables, but rather generates machine code which is saved in the image. This image can then be deployed with the deploy-tool which produces a minimal tree shaken image along with the VM.

When using the stack system does not suffice, lexical and dynamic scoping are supported alternatives. Factor has a growing library which supports vocabularies, continuations, an HTTP server and accompanying web framework, an OpenGL binding, a GUI library, an XML parser, and several other utilities.

One of Factor's main goals is to be useful for interactive and test-driven development, which is why Factor is, at its core, a safe version of Forth. Factor is dynamically typed, but the compiler assesses the stack depth of words (functions).

Lisp Like Features

Factor shares a lot of features with Lisp, including a homoiconic syntax, garbage collection, HOFs, compile-time evaluation, REPL, treeshaker, etc.

Unlike Lisp, function composition proceeds left to right rather than [ [http://reddit.com/r/programming/info/657vx/comments/c02vk21 Slava Pestov, reddit comment] ] : (loop (print (eval (read)))) [ Read-eval-print loop, Implementation] you would write instead [ read eval print ] loop [ [http://www.reddit.com/info/6pq50/comments/c04jxfx pjdelport, reddit comment] ] This is an inherent feature in concatenative languages.

Concurrency Support

Factor's concurrency support was insipired by Erlang, Termite, Scheme48 and Java's java.util.concurrent library including basic Lightweight co-operative threads, to advanced libraries supporting Promises/Futures, Mailboxes and Message-passing concurrency.

Implementations

So far, both Java and C implementations have been constructed. The Java implementation is deprecated and no longer maintained. The native runtime of the C version is continually shrinking as an increasing proportion of Factor is self-hosted [ [http://lambda-the-ultimate.org/node/900#comment-8675 Concatenative Language Kont | Lambda the Ultimate ] ] :

M: compound (compile) compiling dataflow optimize linearize simplify generate ;

However, there will likely always be a portion of Factor written in C. Though Factor does not adhere to an external standard the way C does, the language is heavily documented.

External links

* [http://factorcode.org/ Factor website]
* [http://factorcode.org/binaries.fhtml Get Factor]
* [http://fun-factor.blogspot.com/2007/10/getting-started-with-factor-easy-ffi.html Getting started with Factor - Easy FFI]
* [http://tech.groups.yahoo.com/group/concatenative/message/1756 The birth of Factor]
* [https://lists.sourceforge.net/lists/listinfo/factor-talk Factor mailing list]
* [http://tunes.org/~nef/logs/concatenative Logs of #concatenative] on freenode, an IRC channel which mainly discusses Factor
* [http://docs.factorcode.org/ Factor documentation]
* [http://planet.factorcode.org/ planet-factor] (a feed aggregator)
* [http://factorcode.org/responder/cgi/gitweb.cgi?p=factor.git;a=summary Git development repository]

References


Wikimedia Foundation. 2010.

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

Look at other dictionaries:

  • Concatenative programming language — Programming paradigms Agent oriented Automata based Component based Flow based Pipelined Concatenative Concurr …   Wikipedia

  • Self (programming language) — Infobox programming language name = Self paradigm = object oriented prototype based year = 1986 designer = David Ungar, Randall Smith developer = David Ungar, Randall Smith, Stanford University, Sun Microsystems latest release version = 4.3… …   Wikipedia

  • Haskell (programming language) — Haskell Paradigm(s) functional, lazy/non strict, modular Appeared in 1990 Designed by Simon Peyton Jones, Lennart Aug …   Wikipedia

  • Mesa (programming language) — Mesa Appeared in 1970s and 80s Developer Xerox PARC Typing discipline strongly typed Influenced by ALGOL Influenced Java, Modula 2, Cedar Mesa was an innovat …   Wikipedia

  • Forth (programming language) — infobox programming language name = Forth paradigm = Procedural, stack oriented year = 1970s designer = Charles H. Moore typing = typeless dialects = colorForth, Open Firmware implementations = Forth, Inc., GNU Forth, MPE influenced by =… …   Wikipedia

  • MAD (programming language) — MAD Paradigm(s) Imperative Appeared in 1959 Developer Galler, Arden, and Graham Major implementations IBM 704, IBM 7090, UNIVAC 1108, Philco 210 211, IBM S/360, and IBM S/370 …   Wikipedia

  • XL (programming language) — XL stands for eXtensible Language. It is a computer programming language designed to support concept programming.XL features programmer reconfigurable syntax and semantics. Compiler plug ins can be used to add new features to the language. A base …   Wikipedia

  • Cat (programming language) — Infobox programming language name = Cat paradigm = multi paradigm: functional, stack oriented year = 2006 designer = [http://www.cat language.com Christopher Diggins] latest release version = 0.10.3 latest release date = April 3, 2007 typing =… …   Wikipedia

  • Joy (programming language) — Joy Paradigm(s) multi paradigm: functional, concatenative, stack oriented Appeared in 2001 Designed by Manfred von Thun Developer Manfred von Thun, John Cowan St …   Wikipedia

  • FOCAL (programming language) — FOCAL, (abbreviation of FOrmula CALculator), is an interpreted programming language resembling JOSS.Largely the creation of Richard Merrill, FOCAL was initially written for and had its largest impact on the Digital Equipment Corporation s (DEC s) …   Wikipedia

Share the article and excerpts

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