Get Started

You can download one of the following pre-built min binaries:

Tip

A printable, self-contained guide containing more or less the same content of this web site can be downloaded from here.

Building from Source

Alternatively, you can build min from source in one of the following ways:

Using nimble

If you already installed nim, you probably already have the nimble package manager installed.

If that’s the case, simply run nimble install min. This will actually install and run nifty which will download min dependencies for you before compiling.

Without using nimble

  1. Download and install nim.
  2. Download and build nifty, and put the nifty executable somewhere in your $PATH.
  3. Clone the min repository.
  4. Navigate to the min repository local folder.
  5. Run nifty install to download min’s dependencies.
  6. Run nim c -d:release min.nim.

Additional build options

-d:ssl

If the -d:ssl flag is specified when compiling, min will be built with SSL support, so it will be possible to: * perform HTTPS requests with the http Module. * use all the cryptographic symbols defined in the crypto Module.

If this flag is not specified: * It will not be possible to perform HTTPS requests * Only the following symbols will be exposed by the crypto Module: * md5 * sha1 * encode * decode * aes

-d:lite

If the d:lite flag is specified, a more minimal executable file will be generated (typically, it should be called “litemin”), however the following functionalities will not be available:

-d:mini

If the d:mini flag is specified, an even more minimal executable file will be generated (typically, it should be called “minimin”), however the following functionalities will not be available:

Additionally:

Running the min Shell

To start the min shell, run min with no arguments. You will be presented with a prompt displaying the path to the current directory:

min shell v$versio [/Users/h3rald/test]$

You can type min code and press ENTER to evaluate it immediately:

[/Users/h3rald/test]$ 2 2 + 4 [/Users/h3rald/test]$

The result of each operation will be placed on top of the stack, and it will be available to subsequent operation

[/Users/h3rald/test]$ dup * 16 [/Users/h3rald/test]$

To exit min shell, press CTRL+C or type 0 exit and press ENTER.

Tip

By default, the min shell provides advanced features like tab-completion, history, etc. If however, you run into problems, you can disable these features by running min -j instead, and run min shell with a bare-bones REPL.

Executing a min Program

To execute a min script, you can:

min also supports running programs from standard input, so the following command can also be used (on Unix-like system) to run a program saved in myfile.min:

$ cat myfile.min | min

Compiling a min Program

min programs can be compiled to a single executable simply by specifying the -c (or --compile) flag when executing a min file:

$ min -c myfile.min

Essentially, this will:

  1. Generate a myfile.nim containing the equivalent Nim code of your min program.
  2. Call the Nim compiler to do the rest ;)

If you want to pass any options to the Nim compiler (like -d:release for example) you can do so by using the -n (or --passN) option:

$ min -c myfile.min -n:-d:release

Additionally, you can also use -m:<path> (or --module-path) to specify one path containing .min files which will be compiled as well (but not executed) along with the specified file. Whenever a load or a require symbol is used to load/require an external .min file, it will attempt to retrieve its contents from the pre-loaded files first before searching the filesystem.

For example, the following command executed in the root folder of the min project will compile run.min along with all .min files included in the tasks folder and its subfolders:

$ min -c run.min -m:tasks

Similarly, you can also bundle additional files in the executable by specifying the -a:<path> (or --asset-path) option. At runtime, the compiled min program will attempt to lookup bundled asset files before checking the filesystem.

Note

In order to successfully compile .min files, Nim must be installed on your system and min must be installed via nimble.

Syntax Highlighting