Skip to content
A minimalistic coding language
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
examples
.gitattributes
.gitignore
README.md
minilang.py
test.mini

README.md

Minilang

A minimal coding language

Minilang is a coding language designed with simplicity in mind. The language and its implementation are largely without goal, except perhaps one of learning. It is largely work-in-progress, so both the design and implementation are likely to change greatly over time. This interpreter is written in Python3.

The language has variables with arbitrary names - if it isn't a number or a "string literal", it is a variable name. Variables can store a value of one of two types: number and string.

The command set is somewhat limited, but can be powerful if used effectively. Each command is a case-insensitive, three-letter code, followed by whitespace separated arguments. Every command must take up its own line in the program. The language features basic input, output, arithmetic and branching commands. Branching can be used for many control flow features, such as looping and conditional statements.

  • SET variable value
    • Store value with the name variable
    • value may be a "string literal", a number or a variable reference
  • INP variable
    • Take an input and store it with the name variable
    • Input may be a "string literal" or a number (this implementation uses Python's ast.literal_eval to evaluate input)
  • OUT value
    • Output value
    • value may be a "string literal", a number or a variable reference
  • EXT
    • Halt the program immediately
  • ADD augend addend
    • Addition
    • Increase variable augend by number addend
  • SUB minuend subtrahend
    • Subtraction
    • Decrease variable minuend by number subtrahend
  • MUL multiplicand multiplier
    • Multiplication
    • Multiply variable multiplicand by number multiplier
  • DIV dividend divisor
    • Division
    • Divide variable dividend by number divisor
  • EXP base exponent
    • Exponentiation
    • Calculate the exponentth power of base
  • MOD dividend divisor
    • Modulo
    • Get the remainder of performing integer division on dividend by divisor
  • APP string suffix
    • Append
    • Add the string or number suffix to the end of string
  • PRE string prefix
    • Prepend
    • Add the string or number prefix to the start of string
  • BRA label
    • Branch
    • Jump to the line labeled with the name label
  • BRE label value1 value2
    • Branch if equal
    • Jump to the line labeled with the name label if value1 == value2
  • BRT label value
    • Branch if truthy
    • Jump to the line labeled with the name label if value is truthy (not 0 or an empty string)
  • BRF label value
    • Branch if falsy
    • Jump to the line labeled with the name label if value is falsey (0 or an empty string)
  • BRP label value
    • Branch
    • Jump to the line labeled with the name label if the number value is greater than 0
  • BRN label value
    • Branch
    • Jump to the line labeled with the name label if the number value is less than 0
You can’t perform that action at this time.