+ 14
who wants me to create a quick interpreted language in his name?
1 give me your lang name, no name given i will give it your name 2 give me some syntax 3 as i wll be writing the docs wait for surprises i'll try to do all requests just wait if request too many, they will provide the soloLang server a nice practice
7 Réponses
+ 8
hey that's a full blown lang poor me ... quick lang with some syntax XD
ok we take it ! i'll release the lang little by little !
+ 7
Language name : BPLion
Syntax :
OOP
a lot like Python (based on indentation, if/while/def ... : )
for loops:
for variable : start_value...end_value :
The default container is not list but array like in C/Cpp
switch statement :
switch var:
case val:
//no break needed
case val1...val2 :
...
case val1,val2 :
...
default :
...
operator overloading like Cpp :
def operator*(arg1,arg2):
....
You can use any special character to create a new operator like operator$, operator@, operator?
(Part 1/2)
+ 7
comments : //,# for single line
/* */, """ """ for multi line
char and strings : ' for chars, " for strings
strings are mutable
subarray can be created by default like sublist in python : array[1:4:2]
For functions :
return type and variable type are optional (if they are written, a variable from another type can not be used as parameter)
lambda exists and are written like that :
[return type]name(parameters) : statements
return type can be omitted (in this case, remove the [])
A special function type exist, it is simply func
variable :
like python, a variable has no type if not written, if written, the variable cannot have values of another type (they can if it exists a method/function to translate from the original type to the variable type)
translator functions are like in Cpp :
int operator string(string s):
....
types are mandatory here
pointers exists, they are created like that (with a + symbol):
+p
v
p=@v
you have to put a + behind the pointer variable name to tell that it is a pointer, the @ return the address of a variable
You can put more than one + for pointers of pointers of ...
The code is read in a main function
class are declared like in Python, but adding private, protected and public like in Cpp
Function parameters are like in python (you can add an array (*p) and a dictionary (**p))
Default type are :
int
double
bool
char
string
map
Arrays have a size attribute
In class definition, putting a ^ before the attribute name make it read only from outside the class (even derived class)
operators are like in Cpp, apart from & and *, replaced by @ and +
creating a class is like in Cpp
new and delete are also here
static, inline, virtual and define from Cpp are also here, but define syntax use a $ instead of a #
print is already here and a File type exist (not default but standard)
Multiple inheritance is allowed of course
(It is not complete but I think it is a good start :p)
(Part 2/2)
+ 7
XD that's rare for sure !
+ 5
the vatriables have types here or no?
+ 3
Both are allowed ! The efficient way is of course with types but you can remove the type when declaring the variable and it become a no type python like variable
+ 1
Yeah, I putted all cool stuff I could think about into it :p