sun

A programming language for beginners

Prototype rapidly and learn programming concepts

Features

Simple & concise

Sun is designed to be as simple as possible for a beginner to dive into programming. It has all the basic types needed for the average person. Numbers, floats, strings and booleans. Nothing more, nothing less.
// Input & output
Print 'hello world\n'
Print "Pick a number to increment: "
Enter x

Print 'Number incremented: '
Print x+1

Functions defined

Sun allows programmers to define functions with their own scope, so they do not fall into the pitfalls of using a global namespace. Functions can also have arguments which are pass-by-reference.
// Factorial of n
Function Factorial(n)
  If n == 1 Then
    Return 1
  EndIf
  Return n * Factorial(n-1)
End

Print Factorial(5)

Flexible arrays

Arrays are designed to be easy to use for a learner. No need to declare an array and its size, just start using it. Arrays can also be used with string keys. It's pass-by-reference by default.
// Linear search example
Print 'Enter 5 items: '
Loop:i=0 to 4
  Enter A[i]
Loop-end:i

Print 'Search item: '
Enter item
found = False
Loop:i=0 to 4
  If item == A[i]
  Then
    Print 'Item: ', item, '\n'
    Print 'Index: ', i, '\n'
    found = True
  EndIf
Loop-end:i

If !found
Then
  Print 'Not found'
EndIf
        

Inspiration

The Sun programming language loosely follows the pseudocode language taught by Dr Juan in Sunway University for our Programming Concepts and Problem Solving class (PRG1114).

As a young programmer, I was often fascinated by how programming languages are created and designed. Along the way, I have went through many half-assed attempts of making one (Maple and JSML). So this is the result of an idea boiling in my head for way too long! Enjoy.

Contact

Kendrick Chan

Twitter GitHub