Mash

From Esolang
Jump to navigation Jump to search

Introduction to Mash

Mash is a esoteric programming language made by User:Twingamerdudes(myself). It was made in C# In around 1-2 weeks (Can't remember when I started it). This wiki page will teach you how to use Mash and its Syntax, plus more.

Syntax

Mash has a simple but tedious syntax. Each command is 1-3 symbols long. Here is a list of commands.

$        -Prints a string in front of it, make sure it ends in a semi-colon. Ex. $Hello World;
_        -Create a variable, you do not assign a value to it using this command. Ex. _TestVar
+_       -Assigns a value to a var in the index, ex. If you create a var test, that has an index of 0, if you then use this command to add a value to it, that index 
          will be 0, you can not edit a variable when it is assigned a value, I will plan to add it later. also if you put ^ in front of the _, it will gather input 
          and put it inside the var. Ex. +_5
v/^      -Adds a pause to the program, ex. you print hello world and you want the user to read it without the program closing before they can, this is the command to 
          do it with. Ex. v/^
%        -Prints the value of the var name in front of it. Ex. %TestVar
-        -Makes the program run forever, the entire program. Ex. -
(        -Makes the line of code run forever. Ex. ($Hello World;
=        -Makes sure 2 values are equal. Ex. =1,1
>        -Makes sure if one value is greater than the other. Ex. >2,1
<        -Makes sure if one value is lesser than the other. Ex. <1,2
!        -Makes sure the values are not equal. Ex. !1,7
{        -If the previous if statement was true then make the line of code run forever. Ex. {$Hello World;
*        -If the if statement was true, then run the line of code once. Ex. *$Hello World;
#        -Deletes variables. Ex. #TestVar
@        -It's an else statement. If the if statement was false, then this runs. Ex. =1,2   @$Not True;   The space is the next line.
m+       -Adds two values together and stores the sum in a variable. Ex. m+1,1,TestVar
m-       -Subtracts two values together and stores the difference into a variable. Ex. m-1,1,TestVar
mx       -Multiples two values together and stores the product into a variable. Ex. mx1,1,TestVar
m/       -Divides two values together and stores the quotient into a variable. Ex. m/1,1,TestVar

So that's the syntax of mash, now let's cover programs.

Programs

Hello World

$Hello World;        -Prints Hello World
v/^                  -Adds a pause

This will print Hello World to the screen

Truth machine

_YourInput      -Makes a variable named YourInput
+_^             -Gathers your input
=YourInput,0    -Checks if the input is equal to 0
*$0;            -If it is zero, print zero once
*v/^            -Adds a pause so the user can see the zero
=YourInput,1    -Checks if the input is 1
{$1;            -Forever prints 1 if the input is 1

This is now a truth machine!

Cat Program

-        -Loops the program forever
_Input   -Creates a var called Input
+_^      -Gets the users input
%Input   -Prints your input
#Input   -Deletes the Variable Input, we do this because variables are based on an index, and with the - the entire code is repeated so if we don't do this, 
          Input will be created over and over again. Therefore, resulting in the first input put in the program, outputting forever.

Calculator

-                   -Loops the program forever
$Calculator;        -Prints Calculator to the screen
_Input              {
+_^
_Input2               -Gathers input
+_^                   -Also creates vars: Input, Input2, and Operation
_Operation
+_^                 }
_Output             -creates a variable named Output, pretty sure you can infer what that does
+_0                 -Assgins zero to Output
=Operation,1        -Checks if Operation is 1(Addition)
*m+Input,Input2,Output         -If it is true, add Input1 and Input2
*%Output                       -Prints Output
=Operation,2                   {
*m-Input,Input2,Output
*%Output
=Operation,3
*mxInput,Input2,Output              -Does same thing for Subtraction, Multiplication, and Division
*%Output
=Operation,4
*m/Input,Input2,Output
*%Output                       }
#Input                         {
#Input2                          -Deletes variables so it can be repeated forever
#Operation
#Output                        }

How to make a mash program

First, make sure you get the Mash Interpreter. Once it is done, go and make a file called (program name).txt Then you gotta make the program. Once you are done doing that, you MUST rename the file and replace .txt with .mash Last, open the Interpreter and paste in the path to your program and then add this at the end: \(program name).mash There you go, you just made a program

Notes and tips

Here is the notes and tips section, consider this as the conclusion.

Tips

  1. You can make comments. To comment, make a new line and type whatever you want! As long as the comment does not include any commands.
  2. If you want to edit your program but don't want to convert it back to a .txt file and then convert it to a .mash file, you can just open it in notepad++ or any IDE that supports any file type.
  3. If you are using Notepad++ you can use the color code I made for it. Just open Npp(Notepad++). Then go to Language, then User Defined Language, and it will pop up a menu. In the menu click Import, then find my Npp color-coded sheet called NppFormat. Now get out of User-Defined Language and find mash in the Languages tab, click it. There you go, everything is now color-coded.

Notes

I made this Esolang because I thought it would be fun. Thanks to User:Truttle1 For introducing me to Esolangs through his amazing videos. Also, making a programming language is hard lol.