Skip to content

Commit

Permalink
Merge pull request #1067 from andrew-johnson-4/port-lm-libs-to-lsts
Browse files Browse the repository at this point in the history
Port lm libs to lsts
  • Loading branch information
andrew-johnson-4 authored Jan 11, 2025
2 parents ab0694f + a6abbf5 commit 9e6263c
Show file tree
Hide file tree
Showing 29 changed files with 23,661 additions and 23,571 deletions.
46,798 changes: 23,406 additions & 23,392 deletions BOOTSTRAP/cli.c

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "lambda_mountain"
version = "1.20.3"
version = "1.20.4"
authors = ["Andrew <andrew@subarctic.org>"]
license = "MIT"
description = "Typed Macro Assembler (backed by Coq proofs-of-correctness)"
Expand Down
17 changes: 0 additions & 17 deletions PLATFORM/C/LIB/array.lm
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,9 @@ const-cons := λ: Blob(: v x)(: i L). (: (
))
) Array<x,CONST>);

(declare-binop( [] Array<base-type,?> U64 base-type ('\[_l x '[_l y ']\]_l) ));
(declare-ternop( set[] Array<base-type,?> U64 base-type base-type ('\[_l x '[_l y ']=_l z \]_l) ));
(declare-binop( + Array<base-type,?> U64 Array<base-type,?> ('\[_l x '+_l y '\]_l) ));
(declare-binop( + Array<base-type,?> I64 Array<base-type,?> ('\[_l x '+_l y '\]_l) ));

(declare-binop( == Array<base-type,?> Array<base-type,?> U64 ('\[_l x '==_l y '\]_l) ));
(declare-binop( != Array<base-type,?> Array<base-type,?> U64 ('\[_l x '!=_l y '\]_l) ));
(declare-binop( < Array<base-type,?> Array<base-type,?> U64 ('\[_l x '<_l y '\]_l) ));
(declare-binop( <= Array<base-type,?> Array<base-type,?> U64 ('\[_l x '<=_l y '\]_l) ));
(declare-binop( > Array<base-type,?> Array<base-type,?> U64 ('\[_l x '>_l y '\]_l) ));
(declare-binop( >= Array<base-type,?> Array<base-type,?> U64 ('\[_l x '>=_l y '\]_l) ));
(declare-binop( - Array<base-type,?> Array<base-type,?> U64 ('\[_l x '-_l y '\]_l) ));

close := λ(: x p). (: (
(let r (as (malloc(sizeof p)) p[]))
(set[]( r 0_u64 x ))
r
) p[]);

(declare-unop( open t t (x) ));
(declare-unop( open Array<base-type,?> base-type ('\[*_l x '\]_l) ));

(declare-unop( & t t[] ('\[&_l x '\]_l) ));
25 changes: 25 additions & 0 deletions PLATFORM/C/LIB/array.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

declare-binop( $"!=", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l"!="; y; l")"; ) );
declare-binop( $"==", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l"=="; y; l")"; ) );
declare-binop( $"<", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l"<"; y; l")"; ) );
declare-binop( $"<=", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l"<="; y; l")"; ) );
declare-binop( $">", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l">"; y; l")"; ) );
declare-binop( $">=", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l">="; y; l")"; ) );

declare-binop( $"+", raw-type(base-type[]), raw-type(U64), raw-type(base-type[]), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"+", raw-type(base-type[]), raw-type(I64), raw-type(base-type[]), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"-", raw-type(base-type[]), raw-type(U64), raw-type(base-type[]), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"-", raw-type(base-type[]), raw-type(I64), raw-type(base-type[]), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"-", raw-type(base-type[]), raw-type(base-type[]), raw-type(U64), ( l"("; x; l"-"; y; l")"; ) );

declare-unop( not, raw-type(base-type[]), raw-type(U64), ( l"(!"; x; l")"; ) );

declare-unop( into-branch-conditional, raw-type(base-type[]), raw-type(BranchConditional), x );

declare-binop( $"[]", raw-type(base-type[]), raw-type(U64), raw-type(base-type), ( l"("; x; l"["; y; l"])"; ) );
declare-ternop( $"set[]", raw-type(base-type[]), raw-type(U64), raw-type(base-type), raw-type(base-type), ( l"("; x; l"["; y; l"]="; z; l")"; ) );

declare-unop( open, raw-type(t), raw-type(t), x );
declare-unop( open, raw-type(base-type[]), raw-type(base-type), (l"(*"; x; l")";) );
declare-unop( $"&", raw-type(t), raw-type(t[]), (l"(&"; x; l")";) );

14 changes: 12 additions & 2 deletions PLATFORM/C/LIB/default.lm
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import PLATFORM/C/LIB/common-macros.lm;
import PLATFORM/C/LIB/platform-macros.lm;
import PLATFORM/C/LIB/blob.lm;
import PLATFORM/C/LIB/primitives.lm;
import PLATFORM/C/LIB/field-accessors.lm;
import PLATFORM/C/LIB/primitives.lsts;
import PLATFORM/C/LIB/field-accessors.lsts;
import PLATFORM/C/LIB/sized.lm;
import PLATFORM/C/LIB/bool.lm;
import PLATFORM/C/LIB/u8.lm;
import PLATFORM/C/LIB/u8.lsts;
import PLATFORM/C/LIB/i8.lm;
import PLATFORM/C/LIB/u16.lm;
import PLATFORM/C/LIB/i16.lm;
Expand All @@ -16,6 +16,15 @@ import PLATFORM/C/LIB/i32.lm;
import PLATFORM/C/LIB/u64.lm;
import PLATFORM/C/LIB/i64.lm;
import PLATFORM/C/LIB/f64.lm;
import PLATFORM/C/LIB/u8.lsts;
import PLATFORM/C/LIB/i8.lsts;
import PLATFORM/C/LIB/u16.lsts;
import PLATFORM/C/LIB/i16.lsts;
import PLATFORM/C/LIB/u32.lsts;
import PLATFORM/C/LIB/i32.lsts;
import PLATFORM/C/LIB/u64.lsts;
import PLATFORM/C/LIB/i64.lsts;
import PLATFORM/C/LIB/f64.lsts;
import PLATFORM/C/LIB/buffer.lm;
import PLATFORM/C/LIB/string.lm;
import PLATFORM/C/LIB/string.lsts;
Expand All @@ -28,6 +37,7 @@ import PLATFORM/C/LIB/list.lsts;
import PLATFORM/C/LIB/vector.lsts;
import PLATFORM/C/LIB/hashtable.lm;
import PLATFORM/C/LIB/array.lm;
import PLATFORM/C/LIB/array.lsts;
import PLATFORM/C/LIB/io.lm;
import PLATFORM/C/LIB/regex.lm;
import PLATFORM/C/LIB/cmp.lsts;
Expand Down
24 changes: 0 additions & 24 deletions PLATFORM/C/LIB/f64.lm
Original file line number Diff line number Diff line change
@@ -1,30 +1,6 @@

fragment type F64; size F64 8; atom suffix F64 _f64;

(declare-binop( != F64 F64 U64 ( '\[_l x '!=_l y '\]_l ) ));
(declare-binop( == F64 F64 U64 ( '\[_l x '==_l y '\]_l ) ));
(declare-binop( < F64 F64 U64 ( '\[_l x '<_l y '\]_l ) ));
(declare-binop( <= F64 F64 U64 ( '\[_l x '<=_l y '\]_l ) ));
(declare-binop( > F64 F64 U64 ( '\[_l x '>_l y '\]_l ) ));
(declare-binop( >= F64 F64 U64 ( '\[_l x '>=_l y '\]_l ) ));

(declare-binop( && F64 F64 U64 ( '\[_l x '&&_l y '\]_l ) ));
(declare-binop( || F64 F64 U64 ( '\[_l x '||_l y '\]_l ) ));

(declare-binop( + F64 F64 F64 ( '\[_l x '+_l y '\]_l ) ));
(declare-binop( - F64 F64 F64 ( '\[_l x '-_l y '\]_l ) ));
(declare-binop( ^ F64 F64 F64 ( '\[_l x '^_l y '\]_l ) ));
(declare-binop( / F64 F64 F64 ( '\[_l x '/_l y '\]_l ) ));
(declare-binop( % F64 F64 F64 ( '\[_l x '%_l y '\]_l ) ));
(declare-binop( * F64 F64 F64 ( '\[_l x '*_l y '\]_l ) ));

(declare-binop( << F64 U64+Constant F64 ( '\[_l x '<<_l y '\]_l ) ));
(declare-binop( >> F64 U64+Constant F64 ( '\[_l x '>>_l y '\]_l ) ));

(declare-unop( not F64 U64 ( '\[!_l x '\]_l ) ));

(declare-unop( into-branch-conditional F64 BranchConditional ( x ) ));

print := λ(: x F64). (: (
(printf( '%lf_s x )) ()
) Nil);
Expand Down
26 changes: 26 additions & 0 deletions PLATFORM/C/LIB/f64.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

declare-binop( $"!=", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l"!="; y; l")"; ) );
declare-binop( $"==", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l"=="; y; l")"; ) );
declare-binop( $"<", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l"<"; y; l")"; ) );
declare-binop( $"<=", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l"<="; y; l")"; ) );
declare-binop( $">", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l">"; y; l")"; ) );
declare-binop( $">=", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l">="; y; l")"; ) );

declare-binop( $"+", raw-type(F64), raw-type(F64), raw-type(F64), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"-", raw-type(F64), raw-type(F64), raw-type(F64), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"^", raw-type(F64), raw-type(F64), raw-type(F64), ( l"("; x; l"^"; y; l")"; ) );
declare-binop( $"/", raw-type(F64), raw-type(F64), raw-type(F64), ( l"("; x; l"/"; y; l")"; ) );
declare-binop( $"%", raw-type(F64), raw-type(F64), raw-type(F64), ( l"("; x; l"%"; y; l")"; ) );
declare-binop( $"*", raw-type(F64), raw-type(F64), raw-type(F64), ( l"("; x; l"*"; y; l")"; ) );

declare-binop( $"&&", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l"&&"; y; l")"; ) );
declare-binop( $"||", raw-type(F64), raw-type(F64), raw-type(U64), ( l"("; x; l"||"; y; l")"; ) );

declare-binop( $"<<", raw-type(F64), raw-type(U64+Constant), raw-type(F64), ( l"("; x; l"<<"; y; l")"; ) );
declare-binop( $">>", raw-type(F64), raw-type(U64+Constant), raw-type(F64), ( l"("; x; l">>"; y; l")"; ) );

declare-unop( not, raw-type(F64), raw-type(U64), ( l"(!"; x; l")"; ) );

declare-unop( into-branch-conditional, raw-type(F64), raw-type(BranchConditional), x );


15 changes: 0 additions & 15 deletions PLATFORM/C/LIB/field-accessors.lm

This file was deleted.

15 changes: 15 additions & 0 deletions PLATFORM/C/LIB/field-accessors.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

declare-unop( $".0", raw-type(LMStruct), raw-type(U64), ( l"("; x; l".field_0)"; ) );
declare-unop( $".1", raw-type(CaseNumber<cn>+Field::1<a>), raw-type(a), ( l"("; x; l".field_"; 1_l + 1000_l * (cn :: L); l")"; ) );
declare-unop( $".2", raw-type(CaseNumber<cn>+Field::2<a>), raw-type(a), ( l"("; x; l".field_"; 2_l + 1000_l * (cn :: L); l")"; ) );
declare-unop( $".3", raw-type(CaseNumber<cn>+Field::3<a>), raw-type(a), ( l"("; x; l".field_"; 3_l + 1000_l * (cn :: L); l")"; ) );
declare-unop( $".4", raw-type(CaseNumber<cn>+Field::4<a>), raw-type(a), ( l"("; x; l".field_"; 4_l + 1000_l * (cn :: L); l")"; ) );
declare-unop( $".5", raw-type(CaseNumber<cn>+Field::5<a>), raw-type(a), ( l"("; x; l".field_"; 5_l + 1000_l * (cn :: L); l")"; ) );
declare-unop( $".6", raw-type(CaseNumber<cn>+Field::6<a>), raw-type(a), ( l"("; x; l".field_"; 6_l + 1000_l * (cn :: L); l")"; ) );

declare-binop( $"set.1", raw-type(CaseNumber<cn>+Field::1<a>), raw-type(a), raw-type(Nil), ( l"({"; x; l".field_"; 1_l + 1000_l * (cn :: L); l"="; y; l";({});})"; ) );
declare-binop( $"set.2", raw-type(CaseNumber<cn>+Field::2<a>), raw-type(a), raw-type(Nil), ( l"({"; x; l".field_"; 2_l + 1000_l * (cn :: L); l"="; y; l";({});})"; ) );
declare-binop( $"set.3", raw-type(CaseNumber<cn>+Field::3<a>), raw-type(a), raw-type(Nil), ( l"({"; x; l".field_"; 3_l + 1000_l * (cn :: L); l"="; y; l";({});})"; ) );
declare-binop( $"set.4", raw-type(CaseNumber<cn>+Field::4<a>), raw-type(a), raw-type(Nil), ( l"({"; x; l".field_"; 4_l + 1000_l * (cn :: L); l"="; y; l";({});})"; ) );
declare-binop( $"set.5", raw-type(CaseNumber<cn>+Field::5<a>), raw-type(a), raw-type(Nil), ( l"({"; x; l".field_"; 5_l + 1000_l * (cn :: L); l"="; y; l";({});})"; ) );
declare-binop( $"set.6", raw-type(CaseNumber<cn>+Field::6<a>), raw-type(a), raw-type(Nil), ( l"({"; x; l".field_"; 6_l + 1000_l * (cn :: L); l"="; y; l";({});})"; ) );
2 changes: 0 additions & 2 deletions PLATFORM/C/LIB/i16.lm
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

fragment type I16; size I16 2; atom suffix I16 _i16;

(declare-unop( into-branch-conditional I16 BranchConditional ( x ) ));

print := λ(: x I16). (: (
(print (as x I64))
) Nil);
18 changes: 18 additions & 0 deletions PLATFORM/C/LIB/i16.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

declare-binop( $"!=", raw-type(I16), raw-type(I16), raw-type(U64), ( l"("; x; l"!="; y; l")"; ) );
declare-binop( $"==", raw-type(I16), raw-type(I16), raw-type(U64), ( l"("; x; l"=="; y; l")"; ) );
declare-binop( $"<", raw-type(I16), raw-type(I16), raw-type(U64), ( l"("; x; l"<"; y; l")"; ) );
declare-binop( $"<=", raw-type(I16), raw-type(I16), raw-type(U64), ( l"("; x; l"<="; y; l")"; ) );
declare-binop( $">", raw-type(I16), raw-type(I16), raw-type(U64), ( l"("; x; l">"; y; l")"; ) );
declare-binop( $">=", raw-type(I16), raw-type(I16), raw-type(U64), ( l"("; x; l">="; y; l")"; ) );

declare-binop( $"+", raw-type(I16), raw-type(I16), raw-type(I16), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"-", raw-type(I16), raw-type(I16), raw-type(I16), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"^", raw-type(I16), raw-type(I16), raw-type(I16), ( l"("; x; l"^"; y; l")"; ) );
declare-binop( $"/", raw-type(I16), raw-type(I16), raw-type(I16), ( l"("; x; l"/"; y; l")"; ) );
declare-binop( $"%", raw-type(I16), raw-type(I16), raw-type(I16), ( l"("; x; l"%"; y; l")"; ) );
declare-binop( $"*", raw-type(I16), raw-type(I16), raw-type(I16), ( l"("; x; l"*"; y; l")"; ) );

declare-unop( not, raw-type(I16), raw-type(U64), ( l"(!"; x; l")"; ) );

declare-unop( into-branch-conditional, raw-type(I16), raw-type(BranchConditional), x );
21 changes: 0 additions & 21 deletions PLATFORM/C/LIB/i32.lm
Original file line number Diff line number Diff line change
@@ -1,27 +1,6 @@

fragment type I32; size I32 4; atom suffix I32 _i32;

(declare-binop( != I32 I32 U64 ( '\[_l x '!=_l y '\]_l ) ));
(declare-binop( == I32 I32 U64 ( '\[_l x '==_l y '\]_l ) ));
(declare-binop( < I32 I32 U64 ( '\[_l x '<_l y '\]_l ) ));
(declare-binop( <= I32 I32 U64 ( '\[_l x '<=_l y '\]_l ) ));
(declare-binop( > I32 I32 U64 ( '\[_l x '>_l y '\]_l ) ));
(declare-binop( >= I32 I32 U64 ( '\[_l x '>=_l y '\]_l ) ));

(declare-binop( && I32 I32 U64 ( '\[_l x '&&_l y '\]_l ) ));
(declare-binop( || I32 I32 U64 ( '\[_l x '||_l y '\]_l ) ));

(declare-binop( + I32 I32 I32 ( '\[_l x '+_l y '\]_l ) ));
(declare-binop( - I32 I32 I32 ( '\[_l x '-_l y '\]_l ) ));
(declare-binop( ^ I32 I32 I32 ( '\[_l x '^_l y '\]_l ) ));
(declare-binop( / I32 I32 I32 ( '\[_l x '/_l y '\]_l ) ));
(declare-binop( % I32 I32 I32 ( '\[_l x '%_l y '\]_l ) ));
(declare-binop( * I32 I32 I32 ( '\[_l x '*_l y '\]_l ) ));

(declare-unop( not I32 U64 ( '\[!_l x '\]_l ) ));

(declare-unop( into-branch-conditional I32 BranchConditional ( x ) ));

print := λ(: x I32). (: (
(print (as x I64))
) Nil);
21 changes: 21 additions & 0 deletions PLATFORM/C/LIB/i32.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

declare-binop( $"!=", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l"!="; y; l")"; ) );
declare-binop( $"==", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l"=="; y; l")"; ) );
declare-binop( $"<", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l"<"; y; l")"; ) );
declare-binop( $"<=", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l"<="; y; l")"; ) );
declare-binop( $">", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l">"; y; l")"; ) );
declare-binop( $">=", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l">="; y; l")"; ) );

declare-binop( $"+", raw-type(I32), raw-type(I32), raw-type(I32), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"-", raw-type(I32), raw-type(I32), raw-type(I32), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"^", raw-type(I32), raw-type(I32), raw-type(I32), ( l"("; x; l"^"; y; l")"; ) );
declare-binop( $"/", raw-type(I32), raw-type(I32), raw-type(I32), ( l"("; x; l"/"; y; l")"; ) );
declare-binop( $"%", raw-type(I32), raw-type(I32), raw-type(I32), ( l"("; x; l"%"; y; l")"; ) );
declare-binop( $"*", raw-type(I32), raw-type(I32), raw-type(I32), ( l"("; x; l"*"; y; l")"; ) );

declare-binop( $"&&", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l"&&"; y; l")"; ) );
declare-binop( $"||", raw-type(I32), raw-type(I32), raw-type(U64), ( l"("; x; l"||"; y; l")"; ) );

declare-unop( not, raw-type(I32), raw-type(U64), ( l"(!"; x; l")"; ) );

declare-unop( into-branch-conditional, raw-type(I32), raw-type(BranchConditional), x );
18 changes: 0 additions & 18 deletions PLATFORM/C/LIB/i64.lm
Original file line number Diff line number Diff line change
@@ -1,24 +1,6 @@

fragment type I64; size I64 8; atom suffix I64 _i64;

(declare-binop( != I64 I64 U64 ( '\[_l x '!=_l y '\]_l ) ));
(declare-binop( == I64 I64 U64 ( '\[_l x '==_l y '\]_l ) ));
(declare-binop( < I64 I64 U64 ( '\[_l x '<_l y '\]_l ) ));
(declare-binop( <= I64 I64 U64 ( '\[_l x '<=_l y '\]_l ) ));
(declare-binop( > I64 I64 U64 ( '\[_l x '>_l y '\]_l ) ));
(declare-binop( >= I64 I64 U64 ( '\[_l x '>=_l y '\]_l ) ));

(declare-binop( + I64 I64 I64 ( '\[_l x '+_l y '\]_l ) ));
(declare-binop( - I64 I64 I64 ( '\[_l x '-_l y '\]_l ) ));
(declare-binop( ^ I64 I64 I64 ( '\[_l x '^_l y '\]_l ) ));
(declare-binop( / I64 I64 I64 ( '\[_l x '/_l y '\]_l ) ));
(declare-binop( % I64 I64 I64 ( '\[_l x '%_l y '\]_l ) ));
(declare-binop( * I64 I64 I64 ( '\[_l x '*_l y '\]_l ) ));

(declare-unop( not I64 U64 ( '\[!_l x '\]_l ) ));

(declare-unop( into-branch-conditional I64 BranchConditional ( x ) ));

minimum-I64 := -2147483648_i64;

print := λ(: x I64). (: (
Expand Down
18 changes: 18 additions & 0 deletions PLATFORM/C/LIB/i64.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

declare-binop( $"!=", raw-type(I64), raw-type(I64), raw-type(U64), ( l"("; x; l"!="; y; l")"; ) );
declare-binop( $"==", raw-type(I64), raw-type(I64), raw-type(U64), ( l"("; x; l"=="; y; l")"; ) );
declare-binop( $"<", raw-type(I64), raw-type(I64), raw-type(U64), ( l"("; x; l"<"; y; l")"; ) );
declare-binop( $"<=", raw-type(I64), raw-type(I64), raw-type(U64), ( l"("; x; l"<="; y; l")"; ) );
declare-binop( $">", raw-type(I64), raw-type(I64), raw-type(U64), ( l"("; x; l">"; y; l")"; ) );
declare-binop( $">=", raw-type(I64), raw-type(I64), raw-type(U64), ( l"("; x; l">="; y; l")"; ) );

declare-binop( $"+", raw-type(I64), raw-type(I64), raw-type(I64), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"-", raw-type(I64), raw-type(I64), raw-type(I64), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"^", raw-type(I64), raw-type(I64), raw-type(I64), ( l"("; x; l"^"; y; l")"; ) );
declare-binop( $"/", raw-type(I64), raw-type(I64), raw-type(I64), ( l"("; x; l"/"; y; l")"; ) );
declare-binop( $"%", raw-type(I64), raw-type(I64), raw-type(I64), ( l"("; x; l"%"; y; l")"; ) );
declare-binop( $"*", raw-type(I64), raw-type(I64), raw-type(I64), ( l"("; x; l"*"; y; l")"; ) );

declare-unop( not, raw-type(I64), raw-type(U64), ( l"(!"; x; l")"; ) );

declare-unop( into-branch-conditional, raw-type(I64), raw-type(BranchConditional), x );
2 changes: 0 additions & 2 deletions PLATFORM/C/LIB/i8.lm
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

fragment type I8; size I8 1; atom suffix I8 _i8;

(declare-unop( into-branch-conditional I8 BranchConditional ( x ) ));

print := λ(: x I8). (: (
(print (as x I64))
) Nil);
18 changes: 18 additions & 0 deletions PLATFORM/C/LIB/i8.lsts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

declare-binop( $"!=", raw-type(I8), raw-type(I8), raw-type(U64), ( l"("; x; l"!="; y; l")"; ) );
declare-binop( $"==", raw-type(I8), raw-type(I8), raw-type(U64), ( l"("; x; l"=="; y; l")"; ) );
declare-binop( $"<", raw-type(I8), raw-type(I8), raw-type(U64), ( l"("; x; l"<"; y; l")"; ) );
declare-binop( $"<=", raw-type(I8), raw-type(I8), raw-type(U64), ( l"("; x; l"<="; y; l")"; ) );
declare-binop( $">", raw-type(I8), raw-type(I8), raw-type(U64), ( l"("; x; l">"; y; l")"; ) );
declare-binop( $">=", raw-type(I8), raw-type(I8), raw-type(U64), ( l"("; x; l">="; y; l")"; ) );

declare-binop( $"+", raw-type(I8), raw-type(I8), raw-type(I8), ( l"("; x; l"+"; y; l")"; ) );
declare-binop( $"-", raw-type(I8), raw-type(I8), raw-type(I8), ( l"("; x; l"-"; y; l")"; ) );
declare-binop( $"^", raw-type(I8), raw-type(I8), raw-type(I8), ( l"("; x; l"^"; y; l")"; ) );
declare-binop( $"/", raw-type(I8), raw-type(I8), raw-type(I8), ( l"("; x; l"/"; y; l")"; ) );
declare-binop( $"%", raw-type(I8), raw-type(I8), raw-type(I8), ( l"("; x; l"%"; y; l")"; ) );
declare-binop( $"*", raw-type(I8), raw-type(I8), raw-type(I8), ( l"("; x; l"*"; y; l")"; ) );

declare-unop( not, raw-type(I8), raw-type(U64), ( l"(!"; x; l")"; ) );

declare-unop( into-branch-conditional, raw-type(I8), raw-type(BranchConditional), x );
10 changes: 0 additions & 10 deletions PLATFORM/C/LIB/primitives.lm
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@ primitive::if := λ: Blob(: ictx ImplicitContext)(: f Any)(: t Any)(: c BranchCo
))
) Nil);

(declare-binop( mov datatype datatype Nil ('\[{_l y '=_l x '\:\[{}\]\:}\]_l) ));

(declare-unop( branchtrue Nil BranchConditional ('1_l) ));
(declare-unop( branchfalse Nil BranchConditional ('0_l) ));

(declare-unop( into-branch-conditional BranchConditional BranchConditional ( x ) ));

(declare-unop( cdecl::return Any Nil ( 'return\s_l x '\:_l ) ));
(declare-unop( cdecl::return Nil Nil ( x '\:_l ) ));

primitive::call := λ: Blob(: ictx ImplicitContext)(: args Any). (: (
(:frame( (:frame ictx) (:frame args) ))
(:expression(
Expand Down
Loading

0 comments on commit 9e6263c

Please sign in to comment.