3232
3333## Features
3434
35- - ** Ahead of time compilation** - Mun is compiled ahead of time (AOT), as opposed to being
36- interpreted or compiled just in time (JIT). By detecting errors in the code during AOT
37- compilation, an entire class of runtime errors is eliminated. This allows developers to stay
38- within the comfort of their IDE instead of having to switch between the IDE and target application
39- to debug runtime errors.
40-
41- - ** Statically typed** - Mun resolves types at compilation time instead of at runtime, resulting in
42- immediate feedback when writing code and opening the door for powerful refactoring tools.
43-
44- - ** First class hot-reloading** - Every aspect of Mun is designed with hot reloading in mind. Hot
45- reloading is the process of changing code and resources of a live application, removing the need
46- to start, stop and recompile an application whenever a function or value is changed.
47-
48- - ** Performance** - AOT compilation combined with static typing ensure that Mun is compiled to
49- machine code that can be natively executed on any target platform. LLVM is used for compilation
50- and optimization, guaranteeing the best possible performance. Hot reloading does introduce a
51- slight runtime overhead, but it can be disabled for production builds to ensure the best possible
35+ - ** Ahead of time compilation** - Mun is compiled ahead of time (AOT), as
36+ opposed to being interpreted or compiled just in time (JIT). By detecting
37+ errors in the code during AOT compilation, an entire class of runtime errors
38+ is eliminated. This allows developers to stay within the comfort of their IDE
39+ instead of having to switch between the IDE and target application to debug
40+ runtime errors.
41+
42+ - ** Statically typed** - Mun resolves types at compilation time instead of at
43+ runtime, resulting in immediate feedback when writing code and opening the
44+ door for powerful refactoring tools.
45+
46+ - ** First class hot-reloading** - Every aspect of Mun is designed with hot
47+ reloading in mind. Hot reloading is the process of changing code and resources
48+ of a live application, removing the need to start, stop and recompile an
49+ application whenever a function or value is changed.
50+
51+ - ** Performance** - AOT compilation combined with static typing ensure that Mun
52+ is compiled to machine code that can be natively executed on any target
53+ platform. LLVM is used for compilation and optimization, guaranteeing the best
54+ possible performance. Hot reloading does introduce a slight runtime overhead,
55+ but it can be disabled for production builds to ensure the best possible
5256 runtime performance.
5357
54- - ** Cross compilation** - The Mun compiler is able to compile to all supported target platforms from
55- any supported compiler platform.
58+ - ** Cross compilation** - The Mun compiler is able to compile to all supported
59+ target platforms from any supported compiler platform.
5660
57- - ** Powerful IDE integration** * not implemented yet* - The Mun language and compiler framework are
58- designed to support source code queries, allowing for powerful IDE integrations such as code
59- completion and refactoring tools.
61+ - ** Powerful IDE integration** * not implemented yet* - The Mun language and
62+ compiler framework are designed to support source code queries, allowing for
63+ powerful IDE integrations such as code completion and refactoring tools.
6064
6165## Example
6266
@@ -119,14 +123,16 @@ fn on_heap() -> GC {
119123
120124## Documentation
121125
122- [ The Mun Programming Language Book] ( https://docs.mun-lang.org/ )
126+ [ The Mun Programming Language Book] ( https://docs.mun-lang.org/ ) is hosted on
127+ [ netlify] ( https://www.netlify.com/ ) .
123128
124129## Pre-Built Binaries
125130
126131** [ NOTE] We do not provide support for milestone releases**
127132
128- Download pre-built binaries of [ milestone releases] ( https://github.com/mun-lang/mun/releases ) for
129- macOS, Linux, and Windows (64-bit only).
133+ Download pre-built binaries of [ milestone
134+ releases] ( https://github.com/mun-lang/mun/releases ) for macOS, Linux, and
135+ Windows (64-bit only).
130136
131137## Building from Source
132138
@@ -141,16 +147,18 @@ rustup](https://www.rust-lang.org/tools/install).
141147
142148#### LLVM
143149
144- Mun targets LLVM 7.1.0. Installing LLVM is platform dependant and as such can be a pain. The
145- following steps are how we install LLVM on [ our CI
150+ Mun targets LLVM 7.1.0. Installing LLVM is platform dependant and as such can be
151+ a pain. The following steps are how we install LLVM on [ our CI
146152runners] ( .github/actions/install-llvm/index.js ) :
147153
148- * *** nix** : Package managers of recent * nix distros can install binary versions of LLVM, e.g.:
154+ * *** nix** : Package managers of recent * nix distros can install binary versions
155+ of LLVM, e.g.:
149156 ``` bash
150157 # Ubuntu 18.04
151158 sudo apt install llvm-7 llvm-7-* liblld-7*
152159 ```
153- * ** Arch Linux** The binary version of LLVM can currently only be installed using an AUR helper, such as ` yay ` :
160+ * ** Arch Linux** The binary version of LLVM can currently only be installed
161+ using an AUR helper, such as ` yay ` :
154162 ``` bash
155163 yay -Syu lld7-headers lld7-libs-static
156164 ```
@@ -162,26 +170,29 @@ runners](.github/actions/install-llvm/index.js):
162170 cd lld7
163171 makepkg -si
164172 ```
165- When running ` llvm-config ` , an error can occur signalling that ` /usr/lib/libtinfo.so.5 ` is
166- missing. If a newer version is present, create a symlink; e.g. `ln -s /usr/lib/libtinfo.so.6
167- /usr/lib/libtinfo.so.5`), otherwise download the library.
168- * ** macOS** : [ Brew] ( https://brew.sh/ ) contains a binary distribution of LLVM 7.1.0. However, as it's
169- not the latest version, it won't be added to the path. We are using
170- [ llvm-sys] ( https://crates.io/crates/llvm-sys ) to manage version, but another option is to export
171- the ` LLVM_SYS_70_PREFIX ` variable, which will not clutter your ` PATH ` . To install:
173+ When running ` llvm-config ` , an error can occur signalling that
174+ ` /usr/lib/libtinfo.so.5 ` is missing. If a newer version is present, create a
175+ symlink; e.g. ` ln -s /usr/lib/libtinfo.so.6 /usr/lib/libtinfo.so.5 ` ),
176+ otherwise download the library.
177+ * ** macOS** : [ Brew] ( https://brew.sh/ ) contains a binary distribution of LLVM
178+ 7.1.0. However, as it's not the latest version, it won't be added to the path.
179+ We are using [ llvm-sys] ( https://crates.io/crates/llvm-sys ) to manage version,
180+ but another option is to export the ` LLVM_SYS_70_PREFIX ` variable, which will
181+ not clutter your ` PATH ` . To install:
172182 ``` bash
173183 brew install llvm@7
174184 # Export LLVM_SYS_PREFIX to not clubber PATH
175185 export LLVM_SYS_PREFIX=$( brew --prefix llvm@7)
176186 ```
177- * ** windows** : Binary distrubutions are available for Windows on the LLVM website, but they
178- do not contain a number of libraries that are required by Mun. To avoid having to go to the
179- trouble of compiling LLVM yourself, we created a
180- [ repository] ( https://github.com/mun-lang/llvm-package-windows ) that automatically compiles the
181- required binaries. It also contains a
187+ * ** windows** : Binary distrubutions are available for Windows on the LLVM
188+ website, but they do not contain a number of libraries that are required by
189+ Mun. To avoid having to go to the trouble of compiling LLVM yourself, we
190+ created a [ repository] ( https://github.com/mun-lang/llvm-package-windows ) that
191+ automatically compiles the required binaries. It also contains a
182192 [ release] ( https://github.com/mun-lang/llvm-package-windows/releases/download/v7.1.0/llvm-7.1.0-windows-x64-msvc15.7z )
183- that you can download and extract to your machine. Once downloaded and extracted, add the ` <extract_dir>/bin `
184- folder to the ` PATH ` environment variable.
193+ that you can download and extract to your machine. Once downloaded and
194+ extracted, add the ` <extract_dir>/bin ` folder to the ` PATH ` environment
195+ variable.
185196
186197### Clone source
187198
@@ -197,12 +208,66 @@ git submodule update --init --recursive
197208cargo build --release
198209```
199210
211+ ## Building Documentation
212+
213+ Building the book requires
214+ [ mdBook] ( https://github.com/rust-lang-nursery/mdBook ) , ideally version 0.3.x. To
215+ install it, run:
216+
217+ ```
218+ $ cargo install mdbook --vers [version-num]
219+ ```
220+
221+ The Mun book uses a [ custom version of
222+ Highlight.js] ( https://github.com/mun-lang/highlight.js ) to enable highlighting
223+ of Mun code. The build version of Highlight.js is required by mdbook in the
224+ ` theme/ ` folder but it is not distributed with the source. Instead, it can be
225+ build by invoking the build script:
226+
227+ ``` bash
228+ cd book
229+ ./ci/build-highlight-js
230+ ```
231+
232+ Every time you change something in the custom version of highlight.js you have
233+ to call the above script to ensure you locally use the latest version.
234+
235+ After generating the custom minified Highlight.js, to build the book, type:
236+
237+ ```
238+ $ mdbook build
239+ ```
240+
241+ The output will be in the book subdirectory. To view the book, open it in your
242+ web browser.
243+
244+ For local development use ` mdbook serve ` instead of ` mdbook build ` . This will
245+ start a local webserver on port ` 3000 ` that serves the book and rebuilds the
246+ content when changes are detected.
247+
248+ All of the above is also combined in a single shell script that can be invoked
249+ by simply running:
250+
251+ ``` bash
252+ ./ci/build
253+ ```
254+
255+ To test the ` rust ` source code in the book, run:
256+
257+ ``` bash
258+ mdbook test -L path/to/target/debug/deps
259+ ```
260+
261+ For this to work, there can only be one ` libmun_runtime-{HASH}.rlib ` file in the
262+ provided library path.
263+
200264## License
201265
202266The Mun Runtime is licensed under either of
203267
204- * Apache License, Version 2.0, ([ LICENSE-APACHE] ( LICENSE-APACHE ) or
268+ * Apache License, Version 2.0, ([ LICENSE-APACHE] ( LICENSE-APACHE ) or
205269 http://www.apache.org/licenses/LICENSE-2.0 )
206- * MIT license ([ LICENSE-MIT] ( LICENSE-MIT ) or http://opensource.org/licenses/MIT )
270+ * MIT license ([ LICENSE-MIT] ( LICENSE-MIT ) or
271+ http://opensource.org/licenses/MIT )
207272
208273 at your option.
0 commit comments