An imperative stack-based programming language developed in python.
Monti is a stack-based language revolving around imperative commands to manipulate the stack.
Some of the features that are currently implemented are as follows:
- Multiple Data types and type conversion
- Common operators (
- Multi line comments
- Nested loops and statements (
- Stack manipulation commands (
- Equality, inequality and other operators (
- User input
- Integer and string manipulation
- User defined commands
- And/Or/Not statements
- Preprocessor statements and C++ style constants with
- Support for Multiple files with
The following will be coming soon:
- Additional data types and operators
The simplest way to use MontiLang is to download the binaries from the Releases page. Alternatively, you can download and build from the source code with the instructions below.
The easiest way to compile and use Monti is through the python package 'Pyinstaller'. Install Pyinstaller from PyPi and download the MontiLang source code.
Note: It is recomended that you build from source, as it is very easy, and gives full access to newer features that have not been added to release yet.
install mysysgit, or download source files directly.
python -m pip install pyinstaller git clone https://github.com/lduck11007/MontiLang.git cd MontiLang/src pyinstaller --icon=../icon.ico main.py -n monti SETX /M path "%path%;C:\[path_to_directory]\MontiLang\src\dist\monti"
pip, or the built-in package manager for your distro to install pyinstaller. If this does not work, install from the Pyinstaller releases and run
setup.py, or run straight from the source code from
git clone https://github.com/lduck11007/MontiLang.git cd /MontiLang/src pyinstaller icon=../icon.ico main.py -n monti PATH=/path/to/location:$PATH
To interpret a Monti file, use
monti [file] <optional flags>
If no file is specified, Monti will launch into an interactive shell
Including the the
-c flag will cause the program to not run, but will preprocess and print the source code as it is read by the interpreter
Example program that takes an input as a number, and prints that far into the Fibonacci sequence.
/# Test Fibonacci program #/ |Enter length of sequence: | INPUT NIP VAR loop . 0 VAR a . 1 VAR b . FOR loop a b + VAR c . a PRINT . b VAR a . c VAR b . ENDFOR
FizzBuzz: Program that loops through numbers 1-100, prints 'fizz' if it is a multiple of 3, 'buzz' if a multiple of 5, and 'fizzbuzz' if both.
&DEFINE LOOP 100& 1 VAR i . FOR LOOP || VAR ln . i 5 % 0 == IF : . ln |Buzz| + VAR ln . ENDIF i 3 % 0 == IF : . ln |Fizz| + VAR ln . ENDIF ln || == IF : . i PRINT . ENDIF ln || != IF : . ln PRINT . ENDIF i 1 + VAR i . ENDFOR
Documentation.mt file in
/examples for a more detailed explanation of language features.
Help contribute to MontiLang, add examples on rosettacode at https://rosettacode.org/wiki/Category:MontiLang
Why MontiLang is better than Python
Better floating point accuracy
>>>0.1 + 0.2 0.30000000000000004
>>>0.1 0.2 + PRINT . 0.3
Easier use of system commands
from os import system command = raw_input() system(command)
Automatic int/float conversion
>>>print 1 / 2 0 # Or: >>>from __future__ import division >>>print 1 / 2 0.5
>>>1 2 / PRINT . 0.5