| ↑ Home |
Usage: moss [options] [file [arguments]]
Options:
-i file Include and execute a file before normal execution.
Multiple files are possible: '-i file1 -i file2'.
-file Shorthand for '-i file'. Have a look at 'lib/include'.
-m Prelude mathematical functions.
-la Prelude mathematical functions and linear algebra.
-sh Prelude shell commands.
-t Prelude development tools.
-u Unchecked mode: do not compile assert statements.
-e "1+2" Evaluate some Moss code inline.
-unsafe Unsafe mode: run the interpreter in privileged mode,
which allows write access to files, network access
and execution of shell commands. Running an untrusted
module in unsafe mode is a security hazard.
-c Compile a module to reduce load time.
Only needed for very large modules.
Crate a file tool.moss with the following content:
#!/usr/bin/env moss use sys: argv print(argv)
Now strip the file name extension from the file name and change the file permission to executeable. Open a terminal in the directory and type in:
./tool hello world
Now copy the file to a place in PATH.
These places are shown by:
echo $PATH
But make sure that the file does not shadow another command with the same name. The program may now be executed in every directory by typing:
tool hello world
Obtain Ubuntu, or else Debian, or else another fancy Linux, or else a fancy POSIX system, or else Windows. If some dependency cannot be fulfilled, set up a minimal build and then add feature after feature until some error occurs.
Windows is currently not supported. If you want to port to Windows, edit the operating system interface:
src/system/system-windows.rs
and send upstream pull request to:
Install dependencies:
sudo apt install rustc
sudo apt install cargo
Alternatively (enables cross compilation):
sudo apt install curl
curl https://sh.rustup.rs -sSf | sh
Install optional dependencies:
sudo apt install libgmp-dev
sudo apt install libsdl2-dev
sudo apt install libsdl2-ttf-dev
Currently unused optional dependencies:
sudo apt install libblas-dev
sudo apt install liblapacke-dev
For the first compilation,
Cargo needs network connection:
[dependencies]
libc = "0.2"
termios = "0.2"
Configure optional dependencies in Cargo.toml:
# Minimal
# default = ["long-none"]
# Basic
# default = ["long-none", "math-la", "math-sf"]
# Full
default = ["long-gmp", "math-la", "math-sf", "graphics"]
Run one of the following:
cargo check
cargo build
cargo build --release
sh make.sh
rustup target add x86_64-unknown-linux-gnu sudo apt install qemu-user sudo apt install gcc-multilib # Workaround for a bug: # /usr/bin/ld: cannot find Scrt1.o: No such file or directory # /usr/bin/ld: cannot find crti.o: No such file or directory cargo build --target x86_64-unknown-linux-gnu qemu-x86_64 ./moss
rustup target add i686-pc-windows-gnu sudo apt install wine # Workaround for a linker bug: # Add these lines to .cargo/config: [target.x86_64-pc-windows-gnu] linker = "/usr/bin/x86_64-w64-mingw32-gcc" [target.i686-pc-windows-gnu] linker = "/usr/bin/i686-w64-mingw32-gcc" rustflags = "-C panic=abort" cargo build --target i686-pc-windows-gnu wine ./moss
Set up the latest development version:
moss
sudo sh install.sh
Maybe you need to switch your operating system account to have
system administration access. Then also run
sh install-lib.sh on your user account to install the
moss library locally. The library will be found at:
/home/account/.moss
# IDE
sudo apt install geany
# Debugger, dynamic program analysis
sudo apt install valgrind
sudo apt install kcachegrind
sudo apt install gdb
# Emulator for cross compiler output
sudo apt install wine
# Compare a file and its modification
sudo apt install kompare
# Find all occurrences of a pattern
egrep -nrwi "regex" ./
() | [] . * ?
{n} {min,} {,max} {min,max}
^ $ \< \> \w \b
# GNU Scientific Library
sudo apt install libgsl-dev