What is available?
At the moment, just a unified compiler and virtual machine running on windows and a bunch of example programs (written in LJ) which illustrate the capabilities of the language. But it is growing.
LJ Syntax
It is a C Like langauge with extra Basic connotations. I am heavily influenced by the two languages I am enamoured of..C and PureBasic of course.
How it works
LJ/Lang compiles the source into a custom ASM language (which can be seen under source), and the inbuilt Virtual Machine runs it.
The language already can use some inline ASM commands for optimization purposes. When it comes to math or operations, LJ/Lang VM will try to work out best way how to deal with the variables and convert them automatically based on what needs to be done with them. Apat from this, a runtime evaluator can process string for more complex (and faster) math computations.
LJ/Lang capabilities
Pointers
Linked Lists
Records (still unsure about this..but its a place holder for databases)
Forgiving variable manipulations (automatic type conversions)
Inline assembly for optimzations
Macros
Functions (parameters can be passed by value or by reference)
What needs to be added
A proper GUI editor
Integrated database operations with the record object
GUI commands
Sound commands
Integrated indexing for linked lists, records and arrays
PB/SB module addon support
Interested parties
If anyone wishes to help in the project, please contact me. The understaking of the task is quite taxing, but I also understand that is not for everyone.
Download link
http://www.sen3.net/files/ljlang.zip
The link provided has the integrated Compiler+VM for windows, and several test examples
2nd-March-2021
EDITED: - 6th-March-2021 Updated and added an example
EDITED: - 9th-March-2021 3 new string commands added
- Edtor can now load & save
- Load+compile as one command
- Unicode bug (possibly) fixed
Examples
Code: Select all
/*
Simple prime number generator
*/
count = 1;
n = 1;
limit = 100;
while (n < limit) {
k=3;
p=1;
n=n+2;
while ((k*k<=n) && (p)) {
p=n/k*k!=n;
k=k+2;
}
if (p) {
print(n, " is prime");
count = count + 1;
}
}
print("Total primes found: ", count );
Code: Select all
a.f = 22 / 7;
b.f = 23 / 7.1;
c = 22/7;
d = 22/7.1;
print( a, " , ", b, " , ", c, " , ", d );
//macro
#mypi (22.01/7.01 - 0.001)#
print((22.01/7.01 - 0.001));
print(#mypi,"++");
f1.f = #pi;
f2.f = #mypi;
print("pi=", f1, " , ", #pi, " , ", f2 );
if( (f1>0.0) == #True ) {
print("True works.");
}
Code: Select all
/*
* Linked Lists objects
*/
//Macro
#ObjPrint i = 0; ForEach(obj) { i = i + 1; print("[",i,"] --> ", obj.get); }#
declare listtest(0);
pub.o NEW object;
ret = listtest();
print("--main--");
i = 0; ForEach(pub)
{
i = i + 1;
print("[",i,"] --> ", pub.get);
}
func listtest()
{
obj.o NEW list;
dim str$(1);
obj.add("Kilo", "Lima", "Mike", "November");
#ObjPrint
obj.add("Alfa", "Bravo", 16, "Charlie", "Delta", "Echo", #pi, "Foxtrot","Juliet","Hotel");
#ObjPrint
pos = obj.pos(#CurrentPosition);
print( "Pos=", pos );
pos = obj.pos(4);
print( "Pos(4)=", pos );
pos = obj.pos();
print( "Pos(4)=", pos );
pos = obj.delete();
pos = obj.delete(6);
#ObjPrint
obj.replace(1,15.1);
obj.replace(2,"Inserted");
#ObjPrint
obj.convert(STR$());
count = SizeOf(str$());
i = 0;
while( i < count){
print("[",i+1,"] -- ",str$(i));
i = i + 1;
}
obj2.o NEW obj;
i = 0; ForEach(obj2)
{
i = i + 1;
print("[",i,"] --> ", obj2.get);
}
pub NEW obj;
}