Hello, I created my own “coding language”, though it’s more like a combination of commands, not unlike those found in something such as an admin command line. I made a demo that you can write the language in, execute it and see the results in a terminal window. You can output, and input and I will add more interactive features later if you guys want. RASM Programming DEMO - Roblox I am writing this post to
a. Showcase it and see what people can write with it.
b. Ask whether you guys think that I should continue development and addition of features to the language. Keep in mind that I have only been working on this for 2-3 days so it is not complete or to be considered good in any notion.
I would love to see what programs your brilliant minds can create. I will show three example programs later, along with documentation of the language.
How to use the game UI
When you first open the demo you will see the following:
Take note of the top buttons/inputs.
Project Name:
The leftmost input box says very directly " Project Name". This is where you will name your project before executing it/switching to another project. This is here so that you can access previous projects in one game session. (I will add data storage later).
ToRaw
The next button that you will notice is “ToRaw”. In this case, ‘Raw’ refers to normal copy/pastable text and is used to convert the GUI editor to text. This is useful if you wish to first write your project in the editor, then share it or save it somewhere else on your computer.
Open From
Allows you to open previous projects that you made, saved, and named in this session. I will try to add data saving if you guys want it.
Raw Write
This button could also be called conversion as it takes the regular text in the box and converts it to GUI lines. This may be useful if you need to quickly know your line numbers, which you will learn about later. After writing your text, click the button again and watch it be converted to a GUI editor.
Save and Exit
The name will change later to save and execute. It does as the upcoming name implies, it saves the project and starts executing it, on the terminal screen. You must have a project name beforehand, or it will not work!.
The Editor
As for the editor itself, it is not very useful at the moment and is more for testing when I add a better one in the future. A future one may have full functionality, syntax highlighting, and autocomplete (maybe). It is mostly useful for when you need to quickly see which line number you have because It is required for writing the language.
Now that we know what they do, let’s look at an example of using these. Feel free to comment if you need any help, or have any questions.
Now for the actual language documentation! Keep in mind that I may add small new features and not immediately update this documentation, but I should do it quickly.
LANGUAGE INTRO & DOCUMENTATION
As you may or may not have caught from looking at the code from the video, you see that every line had a similar format. This format is as follows: “function name - parameter1, parameter2, etc;”. Every code line must include a “-” minus symbol following the function name, then the function arguments, ended by a “;”. Nothing after the; will count on that line. This is where you can place comments following code, or any line not containing both “;” and “-” will not be counted as code and assumed to be a comment. Let’s look at an example:
set-firstvariable, string, hello_world;
The set command is used to “set” a variable to a value. Variables are statically typed meaning that they must contain an identifier before the value. You do not need to include identifiers elsewhere.
Data Types
The four categories of data types are:
string: any chars are acceptable, exclusive of whitespace and “;”.
integer:0-9 inclusive of floats, doubles, etc.
boolean: false, true, NULL.
array:Any chars separated by “.” ex: 1.2.3.4.5.6.
Function arguments:
Every command is a function that excepts 0 or more arguments following the “-”;
arguments are separated by commas “,”. It is worth noting that almost every function argument is not in its raw form. This means that arguments are references to the name of variables only, except in select cases. This means that you need to create variables containing information before the function call, using mov or set.
Function Syntax
As mentioned previously, all functions are called in the following way,
FuncName-Arguments, …;
Comments
Any code line not containing both “;” and “-” is considered a comment, and everything on a line following the function call terminator “;”.
Spacing
All whitespace is ignored, including in strings. I may change this later, or add ways around it.
Capitalization:
All functions are eventually completely capitalized, but the compiler automatically uses the Lua function string.upper, so feel free to write them lowercase or uppercase, it’s your preference. Variables are case-sensitive, so be careful, var and Var are not the same things.
Ex: set, SET, Set
are all the same.
Variables
Are created using set
, and some things auto-created in certain functions. They are case-sensitive. These are almost always the only way to communicate information, so make sure not to call a function with a raw value.
All functions, their uses, and their arguments.
SET: Used to instantiate variables. Please do this at the top of the program for readability and better functionality.
Parameters: Variable_Name, DataType, Value.
Example: Set-MyFirstVar, string, helloFromVar;
MOV: Used to move the value of variable two to variable one.
Arguments: ReceivingVarName, TransferingVarName;
Example: Mov-player, score;
ADD, SUB, MUL, & DIV: Preform the given arithmetic operation on var1 from var2. The result is stored in the first variable. Luau equivalent of Var1 (±*/)=Var2.
Arguments: IntegerVar1, IntegerVar2;
Example(s): Add-five,four; Sub-five,four; Mul-five,four; Div-five,four;
CMP: Compares Value 1 with respect to Value 2. This sets 4 key variables which can be used by the jump functions to create if statements, loops, and other logic. Possible value comparisons are equal to, not equal to, greater than, and less than.
Arguments:Variable1, Variable2
Example: Cmp-ValofFive, ValofFour; Would be Not equal and greater than.
JMP, JE, JNE, JG, JL: These are all functions that “jump” to a line of code. Remember how I said the editor could be useful? You will need to know the exact line, so save writing the line # until the end. These are all jumps but function differently. The first jumps to the line regardless, while the others are all a certain condition previously checked by a CMP statement.
JE, JNE, JG, and JL; These jump if and only if the condition is true. JE= Jump if Equal, JNE= Jump if not Equal, JG= Jump if Greater, JL= Jump if Less.
Arguments: LineNumberToJumpTo;
Examples: JL-5; JG-7; JE-10; JNE-5; JMP-10;
DISP:Displays a given value (a variable) to the output.
Arguments: VariableNameWithInfoToOutput
Example: Disp-HelloWorldVar;
ARRAY.INDEX:I will add more array functions later, just let me know what you would like to see. This index the given array at index value, and sets the result to a given varname.
Arguments: arrayVariableName, ArrayPosition, VarNameToStoreIn;
Examples: Array.Index-Myarray, 5, res;
LEN:Gives the length of the object and stores it in the variable. For types, not strings or aarraysrray, returns 1.
Arguments: Object (string or array), ResultVariable;
Examples:Len-MyString, res;
ARRAY.APPEND:Adds given element to the given array at the last position.
Arguments:ArrayName, Value(VarName);
Examples:array.append-mycoolarray, valuevarof10;
IN:Short for input, will prompt the user to enter a value and will halt program execution until completed. Displays var1 as message and stores result in argument2.
Arguments: Msg,Result;
Example:In-Msg, result;
RAND_INT: Stores the result of random integer pick through the numbers, var1, var2, and stores in the last argument.
Arguments: Lower, Upper, VarToStore;
Examples: Rand_int-0var,100var, resultvar;
Now we can finally get to the fun part
Here are three examples of programs that I whipped up. The comments on the side will explain, and feel free to look back at the documentation, and leave comments over questions. I will also provide Luau code equivalents.
Program 1, Count To Specified Integer:
set-max,integer, 10000; Sets the end so we know when to stop counting.
set-counter,integer,0; The variable that will be increased;
set-inc,integer,1; Increment value.
add-counter,inc; ; Adds the inc value, 1, to our counter.
cmp-counter,max; Compares our iterating counter variable to the maximum point.
jl-4; Jumps the program execution to line 4, the addition line, if counter < max.
disp-counter; Outputs the final counter variable value.
Be careful not to print every time, otherwise your program could crash your game with large numbers. It can achieve around 100000 with this counting on my machine within 8-9 seconds.
Here is the Lua equivalent:
for counter = 0, 10000, 1 do
continue
end
print(10000)
Program 2, Summation of given integer:
SET-end, integer, 0; Ending, 0
SET-sum, integer, 0; Counter
SET-incr, integer, 1; Decrementer
set-dispmsg, string, EnterAnIntegerToSum; Message to prompt input to user.
IN-dispmsg,init; input prompts the user to enter a number, stores in init
ADD-sum, init; adds nth term to final sum
SUB-init,incr; subtracts last nth value -1
CMP-init, end; checks if init is greater than 0, in which cases continue summing.
JG-6; jumps if init is greater than 0, to the addition line
DISP-sum; displays summation.
Luau equivalent:
local start = 100
local sum = 0
for i = start, 0, -1 do
sum += start
start -= 1
end
**Program three, guessing game: ** Heres a guessing game where it picks a random number, prompts the user until they get it, and displays every guess where the user was over or under.
set-num,integer,0; The num that will be randomly selected
set-guess,integer,1; user guess variable
set-numtries,integer,0; number of tries the user took to get the number
set-lower,integer, 0; lower bound for random
set-upper,integer,1000; upper bound for random
set-inc,integer, 1; increment for number of tries
set-inmsg, string,Enter_A_Guess_Number; message to prompt
set-victoryMsg,string,CORRECT!; victory message to user
set-Higher, string, Over; message if guess is greater than
set-Lower,string, Under; message if guess is lower than
rand_int-lower,upper,num; picks random number between 0,1000
add-numtries,inc; number of tries increases by one
in-inmsg,guess; prompts user for guess
cmp-guess, num; checks if guess is equal to number
je-22; jumps to line 22, victory, if equal
jl-20; jumps to line 20, under
jg-18;jumps to 18, redundant because program will continue there anyways
disp-Higher; displays over msg
jmp-12; goes back to try again
disp-Lower; displays under message
jmp-12; goes back to try again
disp-victoryMsg; victory!
disp-numtries; Displays how many tries user took
Thank you for reading, and hopefully trying the game for yourself. Keep in mind, this post was written within 1-2 hours, and the game was made within 2-3 days, so there will be bugs and flaws in both. I would love feedback on this language & game, what I could add, if should I even pursue the idea at all, and your own creations. Post your creations in the comments below to share with all, and try others’ creations using the raw write button.