Calbabreaker / simple-language-maybe-intepreted

A simple language maybe

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Simple Language Maybe

Running

Run like this where the first argument would be the file to a slm script:

cargo run -r hello.slm

Specification

Syntax

Comments can be declared with # where # will comment out all the text until the end of the line. Code between #* and *# will be comments as well:

# This is comment
#*
    This is another comment
    This is another comment
*#

Variables are created using = or := for constants:

variable = "hello"
gravity := 9.1

The seperator for each statement is a linebreak. Use ~ if multiple statement are need on one line with each side of the ~ needing to be a statement:

var1 = "yes" ~ var2 = "no"

Functions are called with arguments being seperated by spaces or a seperator:

print "Hello World" variable variable2
# Or:
print"Hello World"variable variable2

() can be used to execute code where the value of the last statement will be returned (or returned with return). This can be multiline:

print (read_file "hello")
print (
    user = "Hello"
    get_password(user) # or return get_password(user)
)
# Required if doing math like this:
print (1 + 2)

Define functions using func and set it as a variable:

say_hello = func arg1 agr2 (

)

Style

Files should end in .slm.

About

A simple language maybe

License:MIT License


Languages

Language:Rust 100.0%