Skip to content

Andrew-Pynch/PSharp-Programming-Language

Repository files navigation

P# Programming Language

Rust Build & Test

P Sharp is my stab at creating a programming language that combines my favorite elements from different languages. Key points include...

Compiled Language

Strongly Typed

Syntax

Imports

import packageName as name

Math

** = Exponent
%  = Modulus
// = Integer Division
/  = Division
*  = Multiplication
-  = Subtraction
+  = Addition

Boolean Operators

true
false

Logic Operators

== = Equal to
!= = Not equal to
<  = Less than
>  = Greater than
<= = Less than or Equal to
>= = Greater than or Equal to

is = return true if a is b
is not = return true if a is not b

Declaring variables with types

name string = 'andrew';

Functions

functionName returnType(parameter1 string) {
    print('Hello world!');
}

Loops

// For loops
for variable in condition {
    if (condition == true) {
        keep doing thing
    }
    else {
        break
    }
}

//  While loops
while condition {
    if (condition == true) {
        keep doing thing
    }
    else {
        break
    }
}

Arrays

// Declaring a new array!!!
names List<string> = ['Andrew', 'James'];

Tuples

numbers Tuple(int, int) = (1, 4);

Error Handling

Comments

// this is a comment homie

Print

print('thing');

Casting variables

age string = '100';
// cast string age to an int
int(age);

About

Messing around with making my own programming language

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages