mirror of
https://github.com/egormanga/Slang.git
synced 2025-08-01 09:26:58 +03:00
Huge work; i'm too tired to write commit message for all of it. Pleez let me sleep acouple of hours. Made most tests work. Started SBC.
This commit is contained in:
16
stdlib/io.sld
Normal file
16
stdlib/io.sld
Normal file
@@ -0,0 +1,16 @@
|
||||
import sld:std:*;
|
||||
|
||||
class fd {
|
||||
str read();
|
||||
str read(int n);
|
||||
|
||||
int write(str data);
|
||||
}
|
||||
|
||||
class stdio {
|
||||
str readln();
|
||||
|
||||
void print(*args);
|
||||
|
||||
void println(*args);
|
||||
}
|
117
stdlib/std.sld
Normal file
117
stdlib/std.sld
Normal file
@@ -0,0 +1,117 @@
|
||||
class void {}
|
||||
|
||||
class bool {
|
||||
castable to int;
|
||||
|
||||
bool operator !;
|
||||
}
|
||||
|
||||
class int {
|
||||
castable to bool;
|
||||
castable to float;
|
||||
|
||||
int operator +;
|
||||
int operator -;
|
||||
int operator ~;
|
||||
|
||||
int operator +int;
|
||||
int operator -int;
|
||||
int operator *int;
|
||||
int operator //int;
|
||||
int operator **int;
|
||||
int operator <<int;
|
||||
int operator >>int;
|
||||
int operator ∫
|
||||
int operator ^int;
|
||||
int operator |int;
|
||||
|
||||
range operator to int;
|
||||
|
||||
int popcount();
|
||||
int length(int base=2);
|
||||
}
|
||||
|
||||
class float {
|
||||
float operator +;
|
||||
float operator -;
|
||||
bool operator !;
|
||||
|
||||
float operator +float;
|
||||
float operator -float;
|
||||
float operator *float;
|
||||
float operator /float;
|
||||
int operator //float;
|
||||
float operator **float;
|
||||
|
||||
int round();
|
||||
bool isint();
|
||||
}
|
||||
|
||||
class char {
|
||||
castable to str;
|
||||
|
||||
bool operator !;
|
||||
|
||||
char operator +char;
|
||||
char operator +int;
|
||||
char operator -char;
|
||||
char operator -int;
|
||||
char operator *int;
|
||||
|
||||
range operator 'to' char;
|
||||
}
|
||||
|
||||
class str {
|
||||
bool operator !;
|
||||
|
||||
iterable char;
|
||||
|
||||
char operator [int];
|
||||
|
||||
str operator +str;
|
||||
str operator *int;
|
||||
}
|
||||
|
||||
class range {
|
||||
typename type;
|
||||
|
||||
iterable type;
|
||||
|
||||
type operator [int];
|
||||
}
|
||||
|
||||
class list {
|
||||
typename type;
|
||||
|
||||
iterable type;
|
||||
|
||||
type operator [int];
|
||||
|
||||
void append(type item);
|
||||
|
||||
void insert(int index, type item);
|
||||
|
||||
type pop();
|
||||
type pop(int index);
|
||||
|
||||
void reverse();
|
||||
|
||||
void sort();
|
||||
}
|
||||
|
||||
class tuple {
|
||||
typename types[];
|
||||
|
||||
iterable types;
|
||||
|
||||
types operator [int];
|
||||
}
|
||||
|
||||
class function {
|
||||
typename argtypes[];
|
||||
typename rettype;
|
||||
|
||||
call rettype (*argtypes);
|
||||
|
||||
rettype map(iterable);
|
||||
}
|
Reference in New Issue
Block a user