Syntax Ideas

+3 Daniel Collier · March 12, 2015
we need to have an idea of the syntax before we start that includes 

  • functions

  • variables and arrays

do we was to go down the single variable type like javascript "var" or use seperate types like int char byte.... i vote for the simple option to try and keep it as simple as possible.

Post a Reply


Oldest  Newest  Rating
+1 Abdullah Nauman · March 12, 2015
Yes, like it says on the Github page the language should be geared towards making coding simper.

Basically this

function hey() { 
var x; 
x = 5;



create hey() ->  x = 5; 
addto hey() -> display x; /* the 'addto' command means add another step to the same function */



As for arrays we could do something like this: 

int stuff[5];
stuff[0] = 10;
stuff[1] = 20;
stuff[2] = 402;
stuff[3] = 20;
stuff[4] = 10;
stuff[5] = 20;


list stuff = [10,20,402,20,10,20]

See what I am talking about :) 
0 Sheldon Juncker · March 13, 2015
I would say that the way that JavaScript handles functions is better than the proposed syntax just because it is a lot more clear and standard. Also, JavaScript already supports arrays with the [1,2,3] syntax.

Since the language is going to be optionally strongly typed, functions could have the following layout:

type? name (parameters*)

number max(number a, number b)
return (a > b) ? a : b;
0 Sheldon Juncker · March 13, 2015
I think that we should use your layout for arrays though. We'll have a list data type that can be used for arrays.

We could also have dictionary data types that use the { key : value } syntax.
0 Daniel Collier · March 13, 2015
i agree with sheldon, i dont think we should use the add to. that just adds a whole new depth of complexity, i love the array init though.
0 Abdullah Nauman · March 14, 2015
Yea, Sheldon's proposed idea is better. Though I don't really understand what the ?s mean.
+1 Sheldon Juncker · March 15, 2015
I was using regular expression syntax. The ? means that the keyword is optional. The * means that there can be zero or more and the + means one or more.

I should have been more clear.
+1 Abdullah Nauman · March 15, 2015
Oh, ok.
  • 1

Orion Programming Language Project


This forum is for the users on TNB who are working on developing the Orion programming language. Anyone is welcome to take part in this project. More information will be posted soon.