- Cleaned up the homepage
This commit is contained in:
parent
3087a3c7cd
commit
f27e340e9d
658
docs/index.md
658
docs/index.md
|
@ -22,660 +22,10 @@ Welcome to the official homepage for the Tristan programming language project.
|
|||
|
||||
---
|
||||
|
||||
Take a look at some example programs written in T!
|
||||
## Example programs
|
||||
|
||||
=== "OOP program"
|
||||
Take a look at some [example programs]() written in T!
|
||||
|
||||
```d
|
||||
module typeChecking2;
|
||||
## Get in touch
|
||||
|
||||
A aInstance;
|
||||
B bInstance;
|
||||
|
||||
int j = 1;
|
||||
int k = j+1;
|
||||
int p = k+j;
|
||||
|
||||
C cInstance;
|
||||
|
||||
class A
|
||||
{
|
||||
static int pStatic;
|
||||
static B bInstanceStatic;
|
||||
static A aInstanceStaticMoi;
|
||||
|
||||
int poes;
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
static int jStatic;
|
||||
static A aInstanceStatic;
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
static int j=1;
|
||||
static int k = j;
|
||||
int p;
|
||||
}
|
||||
```
|
||||
|
||||
=== "Function calls"
|
||||
|
||||
```d
|
||||
module simple;
|
||||
int j = 1+func(3,test()+t2()+t2());
|
||||
j = 2+func(-69,test());
|
||||
|
||||
int func(int x1, byte x2)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
byte t2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
byte test()
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
=== "Complicated programs"
|
||||
|
||||
```d
|
||||
module myModule;
|
||||
|
||||
|
||||
int x;
|
||||
ubyte y;
|
||||
|
||||
int a;
|
||||
int b = a;
|
||||
int c = myModule.x;
|
||||
int l;
|
||||
|
||||
l=2;
|
||||
l=l;
|
||||
|
||||
|
||||
int o = myModule.l;
|
||||
|
||||
|
||||
int f = f.L(f(1+f.d.d.d()));
|
||||
int p = f2p.j2.p;
|
||||
|
||||
int ll = f(1,1);
|
||||
|
||||
public ubyte k = 1;
|
||||
private ubyte k2 = 1;
|
||||
protected ubyte k3 = -1;
|
||||
|
||||
class kl
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
struct structTest
|
||||
{
|
||||
int j;
|
||||
int j;
|
||||
|
||||
void pdsjhfjdsf(int j)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void pdsjhfjdsf(int j)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct structTest2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Shekshi
|
||||
{
|
||||
struct structTest
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public struct poesStruct
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Shekshi1
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class kl
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Shekshi2;
|
||||
|
||||
class G
|
||||
{
|
||||
class F
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class X : myModule.ooga
|
||||
{
|
||||
class Y : ooga
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class K : myModule.ooga
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class D : X.Y
|
||||
{
|
||||
class Fok : myModule.ooga
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class F : Shekshi.G.F {}
|
||||
|
||||
class Z : ooga
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ooga : O
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class O : ooga
|
||||
{
|
||||
class I
|
||||
{
|
||||
class L
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Me
|
||||
{
|
||||
class You
|
||||
{
|
||||
class Me
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class InnerMe : Me
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OuterMe
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Us
|
||||
{
|
||||
class Container : Us
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Tom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Poes
|
||||
{
|
||||
class Kak
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Them
|
||||
{
|
||||
class Container
|
||||
{
|
||||
class TestInner : Container
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class TestOuter : Us.Container
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Naai : Us.Poes.Kak
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class naai : testClass.test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class baai : myModule.testClass.test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class testClass
|
||||
{
|
||||
class test2 :testClass
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class oops: myModule.testClass {}
|
||||
|
||||
class test3:test2
|
||||
{
|
||||
class llllll : testClass.test2
|
||||
{
|
||||
class fokfok : llllll
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class gustav : fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest : llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest2 : test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest3 : test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest4 : testClass.test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest5 : O
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest6 : O.I
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest7 : O.I.L
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest9 : L
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class L {}
|
||||
|
||||
class tieg : troy
|
||||
{
|
||||
class troy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class troy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class gabby
|
||||
{
|
||||
class troy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class testtest8 : testtest7, clazz1.nofuck
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class test4 : bruh
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class yoyo
|
||||
{
|
||||
class kaka{}
|
||||
}
|
||||
|
||||
class poop : poop.kaka
|
||||
{
|
||||
class kaka
|
||||
{
|
||||
class eish : poop
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class eish2 : yoyo.kaka
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class j : poop.kaka
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class hi : hi.ho.hee
|
||||
{
|
||||
class ho
|
||||
{
|
||||
class hee
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class clazz1
|
||||
{
|
||||
int k;
|
||||
print("Hello world");
|
||||
class nofuck
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class clazz3
|
||||
{
|
||||
class clazz1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class bruh
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class bruh
|
||||
{
|
||||
class bruh1
|
||||
{
|
||||
class bruh2
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class clazz2 : bruh
|
||||
{
|
||||
class clazzU
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class clazz12
|
||||
{
|
||||
int j;
|
||||
private class clazz_2_2_1 : bruh, clazzU
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected class clazz_2_3
|
||||
{
|
||||
class clazz_2_3_1
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Bhjkfd");
|
||||
}
|
||||
|
||||
if(1)
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Bhjkfd");
|
||||
}
|
||||
|
||||
if(1)
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Bhjkfd");
|
||||
}
|
||||
|
||||
if (1) {} else if(1) {} else {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
print("Hello");
|
||||
}
|
||||
}
|
||||
|
||||
void pdsjhfjdsf(int j)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ko(int j, int k)
|
||||
{
|
||||
|
||||
l.l("");
|
||||
l.l(l.l());
|
||||
|
||||
ubyte thing = "Hello";
|
||||
print("Hello world");
|
||||
print(1+1);
|
||||
print(1+1);
|
||||
|
||||
ubyte eish = 1+1;
|
||||
|
||||
ubyte poes = ((1+1));
|
||||
|
||||
if(1+1)
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
if((1))
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
print("Hello");
|
||||
}
|
||||
}
|
||||
|
||||
if(((2)))
|
||||
{
|
||||
print(1+1);
|
||||
}
|
||||
|
||||
if(2+222222/2)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
while(2+2+2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void brduh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void main(int hello, byte d)
|
||||
{
|
||||
|
||||
void bruh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ubyte kak;
|
||||
ubyte kak2 = -1;
|
||||
ubyte thing = "Hello";
|
||||
print("Hello world");
|
||||
print(1+1);
|
||||
print(1+1);
|
||||
|
||||
ubyte eish = 1+1;
|
||||
|
||||
ubyte poes = ((1+1));
|
||||
|
||||
if(1+1)
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
if((1))
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
print("Hello");
|
||||
}
|
||||
}
|
||||
|
||||
if(((2)))
|
||||
{
|
||||
print(1+1);
|
||||
}
|
||||
|
||||
if(2+222222/2)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
while(2+2+2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
We're available on [BonoboNET](/projects/bonobonet) on the `#tlang`/`#t` channels.
|
|
@ -21,6 +21,7 @@ below, most specific of which are the `*` and `&` unary operators:
|
|||
|----------|---------------------------------------------------------------|----------------------------|
|
||||
| `&` | Gets the address of the identifier | `int* myVarPtr = &myVar` |
|
||||
| `*` | Gets the value at the address held in the referred identifier | `int myVarVal = *myVarPtr` |
|
||||
| `*` | Sets the value at the address held in the referred identifier | `*myVarPtr = 81` |
|
||||
|
||||
Below we will declare a module-level global variable `j` of type `int`
|
||||
and then use a function to indirectly update its value by the use of a
|
||||
|
@ -167,7 +168,35 @@ changed around
|
|||
|
||||
### Array syntax
|
||||
|
||||
**TODO:** Mention the `[<expr>]` syntax
|
||||
One can also use the familiar array syntax to work with pointers, in
|
||||
fact the syntax `<compType>*` (for declaring a pointer to data of type
|
||||
`<compType>`) can also be written as `<compType>[]`, a similar syntax
|
||||
table exists whereby instead of using `*` we use the `[<offset>]`
|
||||
operator:
|
||||
|
||||
**NOTE:** We can only work on this once the arrays branch is done and
|
||||
has been tested with the new pointers code
|
||||
| Operator | Description | Example |
|
||||
|--------------|---------------------------------------------------------------|------------------------------|
|
||||
| `[<offset>]` | Gets the value at the address held in the referred identifier | `int myVarVal = myVarPtr[0]` |
|
||||
| `[<offset>]` | Sets the value at the address held in the referred identifier | `myVarPtr[0] = 81` |
|
||||
|
||||
``` d
|
||||
module simple_stack_array_coerce;
|
||||
|
||||
void coerce(int* in)
|
||||
{
|
||||
in[0] = 69;
|
||||
in[1] = 420;
|
||||
}
|
||||
|
||||
int function()
|
||||
{
|
||||
int[2] stackArr;
|
||||
discard coerce(stackArr);
|
||||
|
||||
return stackArr[0]+stackArr[1];
|
||||
}
|
||||
```
|
||||
|
||||
What we have above is a program that has a function defined as
|
||||
`coerce(int* in)`, we have an `int*` as the parameter and as you can see
|
||||
instead of accessing
|
||||
|
|
|
@ -22,660 +22,10 @@ Welcome to the official homepage for the Tristan programming language project.
|
|||
|
||||
---
|
||||
|
||||
Take a look at some example programs written in T!
|
||||
## Example programs
|
||||
|
||||
=== "OOP program"
|
||||
Take a look at some [example programs]() written in T!
|
||||
|
||||
```d
|
||||
module typeChecking2;
|
||||
## Get in touch
|
||||
|
||||
A aInstance;
|
||||
B bInstance;
|
||||
|
||||
int j = 1;
|
||||
int k = j+1;
|
||||
int p = k+j;
|
||||
|
||||
C cInstance;
|
||||
|
||||
class A
|
||||
{
|
||||
static int pStatic;
|
||||
static B bInstanceStatic;
|
||||
static A aInstanceStaticMoi;
|
||||
|
||||
int poes;
|
||||
}
|
||||
|
||||
class B
|
||||
{
|
||||
static int jStatic;
|
||||
static A aInstanceStatic;
|
||||
}
|
||||
|
||||
class C
|
||||
{
|
||||
static int j=1;
|
||||
static int k = j;
|
||||
int p;
|
||||
}
|
||||
```
|
||||
|
||||
=== "Function calls"
|
||||
|
||||
```d
|
||||
module simple;
|
||||
int j = 1+func(3,test()+t2()+t2());
|
||||
j = 2+func(-69,test());
|
||||
|
||||
int func(int x1, byte x2)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
byte t2()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
byte test()
|
||||
{
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
=== "Complicated programs"
|
||||
|
||||
```d
|
||||
module myModule;
|
||||
|
||||
|
||||
int x;
|
||||
ubyte y;
|
||||
|
||||
int a;
|
||||
int b = a;
|
||||
int c = myModule.x;
|
||||
int l;
|
||||
|
||||
l=2;
|
||||
l=l;
|
||||
|
||||
|
||||
int o = myModule.l;
|
||||
|
||||
|
||||
int f = f.L(f(1+f.d.d.d()));
|
||||
int p = f2p.j2.p;
|
||||
|
||||
int ll = f(1,1);
|
||||
|
||||
public ubyte k = 1;
|
||||
private ubyte k2 = 1;
|
||||
protected ubyte k3 = -1;
|
||||
|
||||
class kl
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
struct structTest
|
||||
{
|
||||
int j;
|
||||
int j;
|
||||
|
||||
void pdsjhfjdsf(int j)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void pdsjhfjdsf(int j)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct structTest2
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Shekshi
|
||||
{
|
||||
struct structTest
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public struct poesStruct
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Shekshi1
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class kl
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int Shekshi2;
|
||||
|
||||
class G
|
||||
{
|
||||
class F
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class X : myModule.ooga
|
||||
{
|
||||
class Y : ooga
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class K : myModule.ooga
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class D : X.Y
|
||||
{
|
||||
class Fok : myModule.ooga
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class F : Shekshi.G.F {}
|
||||
|
||||
class Z : ooga
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class ooga : O
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class O : ooga
|
||||
{
|
||||
class I
|
||||
{
|
||||
class L
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
class Me
|
||||
{
|
||||
class You
|
||||
{
|
||||
class Me
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class InnerMe : Me
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class OuterMe
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Us
|
||||
{
|
||||
class Container : Us
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Tom
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Poes
|
||||
{
|
||||
class Kak
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class Them
|
||||
{
|
||||
class Container
|
||||
{
|
||||
class TestInner : Container
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class TestOuter : Us.Container
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class Naai : Us.Poes.Kak
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class naai : testClass.test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class baai : myModule.testClass.test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class testClass
|
||||
{
|
||||
class test2 :testClass
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class oops: myModule.testClass {}
|
||||
|
||||
class test3:test2
|
||||
{
|
||||
class llllll : testClass.test2
|
||||
{
|
||||
class fokfok : llllll
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class gustav : fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest : llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest2 : test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest3 : test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest4 : testClass.test3.llllll.fokfok
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest5 : O
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest6 : O.I
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest7 : O.I.L
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class testtest9 : L
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class L {}
|
||||
|
||||
class tieg : troy
|
||||
{
|
||||
class troy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class troy
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
class gabby
|
||||
{
|
||||
class troy
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class testtest8 : testtest7, clazz1.nofuck
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class test4 : bruh
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class yoyo
|
||||
{
|
||||
class kaka{}
|
||||
}
|
||||
|
||||
class poop : poop.kaka
|
||||
{
|
||||
class kaka
|
||||
{
|
||||
class eish : poop
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class eish2 : yoyo.kaka
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class j : poop.kaka
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class hi : hi.ho.hee
|
||||
{
|
||||
class ho
|
||||
{
|
||||
class hee
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class clazz1
|
||||
{
|
||||
int k;
|
||||
print("Hello world");
|
||||
class nofuck
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public class clazz3
|
||||
{
|
||||
class clazz1
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
class bruh
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
class bruh
|
||||
{
|
||||
class bruh1
|
||||
{
|
||||
class bruh2
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class clazz2 : bruh
|
||||
{
|
||||
class clazzU
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
class clazz12
|
||||
{
|
||||
int j;
|
||||
private class clazz_2_2_1 : bruh, clazzU
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected class clazz_2_3
|
||||
{
|
||||
class clazz_2_3_1
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Bhjkfd");
|
||||
}
|
||||
|
||||
if(1)
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Bhjkfd");
|
||||
}
|
||||
|
||||
if(1)
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else if(1)
|
||||
{
|
||||
print("Bruh");
|
||||
}
|
||||
else
|
||||
{
|
||||
print("Bhjkfd");
|
||||
}
|
||||
|
||||
if (1) {} else if(1) {} else {}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
print("Hello");
|
||||
}
|
||||
}
|
||||
|
||||
void pdsjhfjdsf(int j)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ko(int j, int k)
|
||||
{
|
||||
|
||||
l.l("");
|
||||
l.l(l.l());
|
||||
|
||||
ubyte thing = "Hello";
|
||||
print("Hello world");
|
||||
print(1+1);
|
||||
print(1+1);
|
||||
|
||||
ubyte eish = 1+1;
|
||||
|
||||
ubyte poes = ((1+1));
|
||||
|
||||
if(1+1)
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
if((1))
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
print("Hello");
|
||||
}
|
||||
}
|
||||
|
||||
if(((2)))
|
||||
{
|
||||
print(1+1);
|
||||
}
|
||||
|
||||
if(2+222222/2)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
while(2+2+2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void brduh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void main(int hello, byte d)
|
||||
{
|
||||
|
||||
void bruh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ubyte kak;
|
||||
ubyte kak2 = -1;
|
||||
ubyte thing = "Hello";
|
||||
print("Hello world");
|
||||
print(1+1);
|
||||
print(1+1);
|
||||
|
||||
ubyte eish = 1+1;
|
||||
|
||||
ubyte poes = ((1+1));
|
||||
|
||||
if(1+1)
|
||||
{
|
||||
if(1)
|
||||
{
|
||||
if((1))
|
||||
{
|
||||
print("Hello");
|
||||
}
|
||||
print("Hello");
|
||||
}
|
||||
}
|
||||
|
||||
if(((2)))
|
||||
{
|
||||
print(1+1);
|
||||
}
|
||||
|
||||
if(2+222222/2)
|
||||
{
|
||||
while(1)
|
||||
{
|
||||
while(2+2+2)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
We're available on [BonoboNET](/projects/bonobonet) on the `#tlang`/`#t` channels.
|
|
@ -18,6 +18,7 @@ There are a few operators that can be used on pointers which are shown below, mo
|
|||
|----------|-------------|--------|
|
||||
| `&` | Gets the address of the identifier | `int* myVarPtr = &myVar` |
|
||||
| `*` | Gets the value at the address held in the referred identifier | `int myVarVal = *myVarPtr` |
|
||||
| `*` | Sets the value at the address held in the referred identifier | `*myVarPtr = 81` |
|
||||
|
||||
Below we will declare a module-level global variable `j` of type `int` and then use a function to indirectly update its value by the use of a pointer to this integer - in other words an `int*`:
|
||||
|
||||
|
@ -142,6 +143,29 @@ NOTE: This appears before the array syntax, this should probaly be changed aroun
|
|||
|
||||
### Array syntax
|
||||
|
||||
**TODO:** Mention the `[<expr>]` syntax
|
||||
One can also use the familiar array syntax to work with pointers, in fact the syntax `<compType>*` (for declaring a pointer to data of type `<compType>`) can also be written as `<compType>[]`, a similar syntax table exists whereby instead of using `*` we use the `[<offset>]` operator:
|
||||
|
||||
**NOTE:** We can only work on this once the arrays branch is done and has been tested with the new pointers code
|
||||
| Operator | Description | Example|
|
||||
|----------|-------------|--------|
|
||||
| `[<offset>]` | Gets the value at the address held in the referred identifier | `int myVarVal = myVarPtr[0]` |
|
||||
| `[<offset>]` | Sets the value at the address held in the referred identifier | `myVarPtr[0] = 81` |
|
||||
|
||||
```{.d numberLines="1"}
|
||||
module simple_stack_array_coerce;
|
||||
|
||||
void coerce(int* in)
|
||||
{
|
||||
in[0] = 69;
|
||||
in[1] = 420;
|
||||
}
|
||||
|
||||
int function()
|
||||
{
|
||||
int[2] stackArr;
|
||||
discard coerce(stackArr);
|
||||
|
||||
return stackArr[0]+stackArr[1];
|
||||
}
|
||||
```
|
||||
|
||||
What we have above is a program that has a function defined as `coerce(int* in)`, we have an `int*` as the parameter and as you can see instead of accessing
|
|
@ -0,0 +1,4 @@
|
|||
Standard library
|
||||
================
|
||||
|
||||
The `tlib` is an assortment of code written in T itself to provide a usable set of facilities for common tasks.
|
Loading…
Reference in New Issue