docs/get-started.md
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
-----
content-type: "page"
title: "Get Started"
-----
{@ _defs_.md || 0 @}
You can build {{m}} from source as follows:
1. Download and install [Nim](https://nim-lang.org).
3. Clone the {{m}} [repository](https://github.com/h3rald/mn).
4. Navigate to the {{m}} repository local folder.
6. Run **./build.sh**.
## Running the mn REPL
To start the {{m}} REPL, run [mn](class:cmd) with no arguments. You will be presented with a prompt displaying the path to the current directory:
> %mn-terminal%
> mn v{{$version}}
> [::](class:prompt)
You can type {{m}} code and press [ENTER](class:kbd) to evaluate it immediately:
> %mn-terminal%
> [::](class:prompt) 2 2 +
> 4
> [::](class:prompt)
The result of each operation will be placed on top of the stack, and it will be available to subsequent operation
> %mn-terminal%
> [::](class:prompt) dup \*
> 16
> [::](class:prompt)
To exit {{m}} shell, press [CTRL+C](class:kbd) or type [0 exit](class:cmd) and press [ENTER](class:kbd).
## Executing an mn Program
To execute a {{m}} script, you can:
- Run `mn -e:"... program ..."` to execute a program inline.
- Run `mn myfile.mn` to execute a program contained in a file.
{{m}} 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.mn](class:file):
> %mn-terminal%
>
> [$](class:prompt) cat myfile.mn | mn
|