]> gitweb.factorcode.org Git - factor.git/blob - README.md
README: adding travis graphic.
[factor.git] / README.md
1 # Factor
2
3 [![](https://api.travis-ci.org/factor/factor.svg)](https://travis-ci.org/factor/factor)
4
5 Factor is a [concatenative](https://www.concatenative.org), stack-based
6 programming language with [high-level
7 features](https://concatenative.org/wiki/view/Factor/Features/The%20language)
8 including dynamic types, extensible syntax, macros, and garbage collection.
9 On a practical side, Factor has a [full-featured
10 library](https://docs.factorcode.org/content/article-vocab-index.html),
11 supports many different platforms, and has been extensively documented.
12
13 The implementation is [fully
14 compiled](https://concatenative.org/wiki/view/Factor/Optimizing%20compiler)
15 for performance, while still supporting [interactive
16 development](https://concatenative.org/wiki/view/Factor/Interactive%20development).
17 Factor applications are portable between all common platforms.  Factor can
18 [deploy stand-alone
19 applications](https://concatenative.org/wiki/view/Factor/Deployment) on all
20 platforms.  Full source code for the Factor project is available under a BSD
21 license.
22
23 ## Getting Started
24
25 ### Building Factor from source
26
27 If you have a build environment set up, then you can build Factor from git.
28 These scripts will attempt to compile the Factor binary and bootstrap from
29 a boot image stored on factorcode.org.
30
31 To check out Factor:
32
33 * `git clone git://github.com/factor/factor.git`
34 * `cd factor`
35
36 To build the latest complete Factor system from git, either use the
37 build script:
38
39 * Unix: `./build.sh update`
40 * Windows: `build.cmd`
41
42 or download the correct boot image for your system from
43 http://downloads.factorcode.org/images/master/, put it in the `factor`
44 directory and run:
45
46 * Unix: `make` and then `./factor -i=boot.unix-x86.64.image`
47 * Windows: `nmake /f Nmakefile x86-64` and then `factor.com -i=boot.windows-x86.64.image`
48
49 Now you should have a complete Factor system ready to run.
50
51 More information on [building factor](https://concatenative.org/wiki/view/Factor/Building%20Factor)
52 and [system requirements](https://concatenative.org/wiki/view/Factor/Requirements).
53
54 ### To run a Factor binary:
55
56 You can download a Factor binary from the grid on [https://factorcode.org](https://factorcode.org).
57 The nightly builds are usually a better experience than the point releases.
58
59 * Windows: Double-click `factor.exe`, or run `.\factor.com` in a command prompt
60 * Mac OS X: Double-click `Factor.app` or run `open Factor.app` in a Terminal
61 * Unix: Run `./factor` in a shell
62
63 ### Learning Factor
64
65 A tutorial is available that can be accessed from the Factor environment:
66
67 ```factor
68 "first-program" help
69 ```
70
71 Some other simple things you can try in the listener:
72
73 ```factor
74 "Hello, world" print
75
76 { 4 8 15 16 23 42 } [ 2 * ] map .
77
78 1000 [1,b] sum .
79
80 4 <iota> [
81     "Happy Birthday " write
82     2 = "dear NAME" "to You" ? print
83 ] each
84 ```
85
86 For more tips, see [Learning Factor](https://concatenative.org/wiki/view/Factor/Learning).
87
88 ## Documentation
89
90 The Factor environment includes extensive reference documentation and a
91 short "cookbook" to help you get started. The best way to read the
92 documentation is in the UI; press F1 in the UI listener to open the help
93 browser tool. You can also [browse the documentation
94 online](https://docs.factorcode.org).
95
96 ## Command Line Usage
97
98 Factor supports a number of command line switches:
99
100 ```
101 Usage: factor [Factor arguments] [script] [script arguments]
102
103 Common arguments:
104     -help            print this message and exit
105     -i=<image>       load Factor image file <image> (default factor.image)
106     -run=<vocab>     run the MAIN: entry point of <vocab>
107         -run=listener    run terminal listener
108         -run=ui.tools    run Factor development UI
109     -e=<code>        evaluate <code>
110     -no-user-init    suppress loading of .factor-rc
111     -roots=<paths>   a list of path-delimited extra vocab roots
112
113 Enter
114     "command-line" help
115 from within Factor for more information.
116 ```
117
118 You can also write scripts that can be run from the terminal, by putting
119 ``#!/path/to/factor`` at the top of your scripts and making them executable.
120
121 ## Source Organization
122
123 The Factor source tree is organized as follows:
124
125 * `vm/` - Factor VM source code (not present in binary packages)
126 * `core/` - Factor core library
127 * `basis/` - Factor basis library, compiler, tools
128 * `extra/` - more libraries and applications
129 * `misc/` - editor modes, icons, etc
130 * `unmaintained/` - now at [factor-unmaintained](https://github.com/factor/factor-unmaintained)
131
132 ## Source History
133
134 During Factor's lifetime, sourcecode has lived in many repositories. Unfortunately, the first import in Git did not keep history. History has been partially recreated from what could be salvaged. Due to the nature of Git, it's only possible to add history without disturbing upstream work, by using replace objects. These need to be manually fetched, or need to be explicitly added to your git remote configuration.
135
136 Use:
137 `git fetch origin 'refs/replace/*:refs/replace/*'`
138
139 or add the following line to your configuration file
140
141 ```
142 [remote "origin"]
143     url = ...
144     fetch = +refs/heads/*:refs/remotes/origin/*
145     ...
146     fetch = +refs/replace/*:refs/replace/*
147 ```
148
149 Then subsequent fetches will automatically update any replace objects.
150
151 ## Community
152
153 Factor developers meet in the `#concatenative` channel on
154 [irc.freenode.net](http://freenode.net). Drop by if you want to discuss
155 anything related to Factor or language design in general.
156
157 * [Factor homepage](https://factorcode.org)
158 * [Concatenative languages wiki](https://concatenative.org)
159 * [Mailing list](factor-talk@lists.sourceforge.net)
160 * Search for "factorcode" on [Gitter](https://gitter.im/)
161
162 Have fun!