Skip to content

yisonPylkita/mssl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mssl - My Simple Scripting Language

Rust

Currently very much in progress!!! - only lexer kind of works right now

I wanted to understand how compiler works so I created one

Code example

# My simple scripting language

# This is a comment
# Every comment starts with # and ends with \n

# This is a scripting language so we do not have a main function

# But we do have a normal functions
# They are declared this way
fn dummy_function(a: i32, b: i32) -> i32 {
    return a + b;
}

# We can have variable declarations
# Right now i32 is the only supported type
let first_num = 2;
let second_num = 5;

Usage

Just lexer result

cargo run -- lex "let x = 10; println(\"Hello world\");"

Run provided code

cargo run -- run "let x = 10; println(\"Hello world\");"

Vim config

I wrote configuration for Vim to support mssl. To enable it run

$ mkdir -p ~/.vim/syntax
$ cp misc/mssl.vim ~/.vim/syntax

and add this line to your .vimrc

au BufRead,BufNewFile *.mssl setfiletype mssl