суббота, 16 апреля 2011 г.

четверг, 24 февраля 2011 г.

Parallel front-end, Units and other tasks

Now working on 5 tasks

1. Support Units.
2. Forward types using without predeclaring.
3. Cross units references resolving with cycles too.
4. Parallel front-end to process units simultaneously.
5. Extend .NET back-end to support units.

четверг, 3 февраля 2011 г.

Changes to POINTERMATH

Now the operator[] of typed pointer returns the dereferenced pointer to type(ref to value).

Thanks to DiamondShark.

A sample

program myprogram;

procedure pf < T> (cnt:integer);
p:pointer;
ptype:^T;
valueA:T;
i:integer;
begin
GetMem(p,cnt*sizeof(T));
ptype:=p;
for i:=0 to cnt-1 do ptype[i]:=valueA;
FreeMem(p);
end;

begin
pf < boolean> (100);
pf < integer> (200);
pf < double> (300);
end

среда, 2 февраля 2011 г.

Getmem, Freemem, Pointer math

YAR language is enhanced by supporting Getmem, Freemem and pointer math.
Sample

program myprogram;

procedure dosample();
p:pointer;
pinteger:^integer;
i:integer;
begin
GetMem(p,400);
pinteger:=p;
for i:=0 to 99 do pinteger[i]^:=i;
for i:=0 to 99 do write pinteger[i]^;
FreeMem(p);
end;

begin
dosample();
end

вторник, 25 января 2011 г.

понедельник, 24 января 2011 г.

Mutable string and pinned managed objects

Added String type to YAR

sample

program myprogram;

procedure abc();
a:string;
i:integer;
begin
a:='abcdefghij';
for i:=0 to a.length()-1 do a[i]:='1';
write a;
end;

begin
abc();
end

=>

.assembly extern mscorlib { auto }
.assembly project {}
.method public static void main() cil managed
{
.entrypoint
call void abc()
ret
}
.method public static void abc() cil managed
{
.locals init(int32 _autoname0,string pinned a,int32 i)
ldstr "abcdefghij"
stloc a
ldc.i4 0
stloc i
ldloc a
callvirt instance int32 [mscorlib]System.String::get_Length()
ldc.i4 1
sub
stloc _autoname0
Label0:
ldloc i
ldloc _autoname0
cgt
brtrue Label1
ldloc a
conv.i
call int32 [mscorlib]System.Runtime.CompilerServices.RuntimeHelpers::get_OffsetToStringData()
add
ldloc i
ldc.i4 2
mul
add
conv.i
ldc.i4 49
stobj char
ldloc i
ldc.i4 1
add
stloc i
br Label0
Label1:
ldloc a
call void [mscorlib]System.Console::Write(string)
ret
}

среда, 22 декабря 2010 г.

YAR: Added explicit type cast

a:integer;
d:double;

begin
...
d:=a; //Implicit
d:=double(a); //Explicit

But! I am still thinking about the syntax for declaring new implicit or explicit operators: Delphi or Free Pascal like. :)