We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

mLang (Mihai Popa)

From Esolang
Jump to navigation Jump to search
Not to be confused with MLang.

mLang is a language made by Mihai Popa. It's simple, but it supports only math and printing! It has no input!!

Commands/Instructions

Command List
Command (Instruction) Meaning Equivalence (in Batch)
add Adds 2 numbers set /a z=%x%+%y%
sub Subtracts 2 numbers set /a z=%x%-%y%
mul Multiplies 2 numbers set /a z=%x%*%y%
div Divides 2 numbers set /a z=%x%/%y%
mod Does a modulo from 2 numbers set /a z=%x%%%%y%
print Prints a text string echo "text"

Interpreter

Batch

@echo off
REM Defition for the "print" instruction.
if /i %1 EQU print goto echo
REM Defition for the "add" instruction.
if /i %1 EQU add goto add
REM Defition for the "sub" instruction.
if /i %1 EQU sub goto sub
REM Defition for the "mul" instruction.
if /i %1 EQU mul goto mul
REM Defition for the "div" instruction.
if /i %1 EQU div goto div
REM Defition for the "mod" instruction.
if /i %1 EQU mod goto mod
goto error
REM Code for the "print" instruction.
:echo
cls
echo mLang Code: %1 %2
echo Batch Code: echo %2
echo Output: %2
pause >nul
exit
REM Code for the "add" instruction.
:add
cls
echo mLang Code: %1 %2 %3
echo Batch Code:
echo.
echo set /a result=%2+%3
echo echo %%result%%
set /a result=%2+%3
echo.
echo Output:
echo %result%
pause >nul
exit
REM Code for the "sub" instruction.
:sub
cls
echo mLang Code: %1 %2 %3
echo Batch Code:
echo.
echo set /a result=%2-%3
echo echo %%result%%
set /a result=%2-%3
echo.
echo Output:
echo %result%
pause >nul
REM Code for the "mul" instruction.
:mul
cls
echo mLang Code: %1 %2 %3
echo Batch Code:
echo.
echo set /a result=%2*%3
echo echo %%result%%
set /a result=%2*%3
echo.
echo Output:
echo %result%
pause >nul
exit
REM Code for the "div" instruction.
:div
cls
echo mLang Code: %1 %2 %3
echo Batch Code:
echo.
echo set /a result=%2/%3
echo echo %%result%%
set /a result=%2/%3
echo.
echo Output:
echo %result%
pause >nul
exit
REM Code for the "mod" instruction.
:mod
cls
echo mLang Code: %1 %2 %3
echo Batch Code:
echo.
echo set /a result=%2%%%%%%3
echo echo %%result%%
set /a result=%2%%%3
echo.
echo Output:
echo %result%
pause >nul
exit
:error
cls
echo Syntax error!
pause >nul

To run, call the code as a argument, like so:

mlang.bat print "Hello, world!"

Examples

Hello, world!

print "Hello, world!"

XKCD Random Number

print 4

A+B Problem

add x y

Replace "x" and "y" by the numbers you want. For example:

add 7 4

See also