Skip to content

Instantly share code, notes, and snippets.

@kittech0
Last active June 18, 2023 08:54
Show Gist options
  • Select an option

  • Save kittech0/4e615e4e5df1cf355cb55a8c10297957 to your computer and use it in GitHub Desktop.

Select an option

Save kittech0/4e615e4e5df1cf355cb55a8c10297957 to your computer and use it in GitHub Desktop.
The Prismatica Programming Language idea

Welcome to the idea of language based around Kotlin and Rust!

Comments

Uses C-like comments

// One liner
function(/* Insides */) // description of it! 
/*
	multiple liner!
*/

Types

Uses rust-like types

  1. i8,i16,i32,i64,i128 and isize signed intiger
  2. u8,u16,u32,u64,u128 and usize unsigned integer
  3. f8,f16,f32,f64,f128 and fsize float
  4. char character (to create character use '' example: 'a')
  5. bool boolean (true or false)

Tuples

Tuple syntax is also rust-like. They are groups with multiple types of values inside with fixed size and can be destructed. Example way of creating:

tuple: (fsize, u16, bool) = (1.0, 24, true)

Accessing value is different than in rust, instead of tuple.i (i is index/place of value in tuple) it uses array like syntax accessing. Example way of accessing value:

value: fsize = tuple[0] //returns 1.0 of type fsize
// remember `tuple` variable is (1.0, 24, true)

You can also destruct the tuples by using different variable syntax which simply destructs the tuple into multiple variables. Example of destruction:

(float: fsize, number: u16, answer: bool) = tuple 
float //returns 1.0 with type fsize
number //returns 24 with type u16
answer //returns true with type bool 

Array

Array syntax is instead kotlin-like. They are groups of same type and with fixed size. Example way of creating:

array: char[5] = ['h','e','l','l','o']

number inside char[5] defines fixed size of array, and char defines type of values in array. You can access value inside array exactly the same way like you did in tuple! Example of accessing value:

letter: char = array[3] //returns `l` with type char
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment