Skip to content

kunrex/Sugar.lang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sugar.Lang

Sugar is a programming language I created a while back. Its object oriented, written in c#, (will) compiles to CIL.

Features that have been implemented:

Variables, Primitives, Arrays, Functions, Output and Input, Generics, Constructors, Indexers, Ternary, Casting, Conditions (if, switch), Loops (for, while, do while, foreach), User Defined Data Types, Properties, Exceptions, Import, Describers, Operator and Cast Overloading, Extension Methods

Note: At the current stage "implemented" means they are parsed successfully.

Basic Syntax

• Variables

//general format for variable creation
Type: name;

int: x;//declaration
int: x = 10;//initialisation
int: x = 10, y = 20;//multiple initialisations for the same type

x = 100;//assignment

Casting

int: x = 3.14 as int;//casting achieved through 'as'

Terneries

int: x = true ? 1 : 3;

• Output and Input

string: name = input("whats you're name");//input method handles input, string parameter optional
print("hi " + name + "!");//print statement handles output, requires 1 parameter

• Functions

//general format
Type Name(Type1: parameter1, /*...*/)
{
  //code
}

void Greet()
{
  print("hi");
}

Greet();//function call

• User Defined Type

class Name
{
  //code
}

//sugar supports classes, enums, interfaces and structs. Declaring any of the previous 3 requires swapping out class for their respective keywords.

About

Just a programming language I made

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages