MontiLang is a Stack-Oriented imperative programming language developed in python. It is highly customisable and contains many features found in higher level and Object Oriented languages.
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.
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
path/to/monti/executable [file] <optional flags>
If no file is specified, Monti will launch into an interactive REPL
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