Mercurial > repos > rhope
diff kernelbase.rhope @ 136:fc3815b7462f
Javascript backend now produces working code for some simple examples, still more of the standard lib that needs to be ported.
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 14 Nov 2010 23:07:55 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernelbase.rhope Sun Nov 14 23:07:55 2010 -0500 @@ -0,0 +1,89 @@ + +Val[in:out] +{ + out <- in +} + +Blueprint Int32 +{ + Num(Int32,Naked) +} + +If@Int32[num:yes,no] +{ + yes,no <- If[[num]!=[0i32]] +} + +Trunc UInt8@UInt8[in:out] +{ + out <- in +} + +Blueprint UInt32 +{ + Num(UInt32,Naked) +} + +If@UInt32[num:yes,no] +{ + yes,no <- If[[num]!=[0u32]] +} + +Blueprint UInt8 +{ + Num(UInt8,Naked) +} + +If@UInt8[num:yes,no] +{ + yes,no <- If[[num]!=[0u8]] +} + +Abs@Int32[num:out] +{ + If[[num]<[0i32]] + { out <- [0i32]-[num] } + { out <- num } +} + +Mod[a,b:out] +{ + out <- [a]-[[[a]/[b]]*[b]] +} + +And[left,right:out] +{ + ,out <- If[left] + { + out,out <- If[right] + } +} + +Or[left,right:out] +{ + out <- If[left] {} + { + out <- right + } +} + +Min[a,b:out] +{ + If[[a]<[b]] + { + out <- a + }{ + out <- b + } +} + +Max[a,b:out] +{ + If[[a]>[b]] + { + out <- a + }{ + out <- b + } +} +