[VER] 0.3.5-alpha
[FEAT] 现在,我们的内置类型 Int, String等也有构造函数了!像是StructType一样调用,Int{10}
[FEAT] List,Map赋值默认为Alias, 现在,通过 List{other}/Map{other} 来创建新的container! 复制出新的容器
[IMPL] Object toString对于 String type 输出进行修改!
[IMPL] ... 还有一些忘记了!
[ALL] Happy new year! And hope Fig-lang become better! Let's build a new world!
This commit is contained in:
94
src/Module/Library/_builtins/_builtins.fig
Normal file
94
src/Module/Library/_builtins/_builtins.fig
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
Module `_builtins`
|
||||
|
||||
This module represents Fig builtin runtime bindings.
|
||||
|
||||
Visible to IDEs and documentation tools,
|
||||
NOT importable, NOT executable as a real module.
|
||||
|
||||
Library/_builtins/_builtins.fig
|
||||
|
||||
Importing `_builtins` in real programs loads native implementations,
|
||||
not this file. This file only serves as documentation / IDE reference.
|
||||
|
||||
Copyright © 2025 PuqiAR. All rights reserved.
|
||||
*/
|
||||
|
||||
// =======================
|
||||
// stdout
|
||||
// =======================
|
||||
|
||||
func __fstdout_print(values ...) -> Int;
|
||||
|
||||
func __fstdout_println(values ...) -> Int;
|
||||
|
||||
|
||||
// =======================
|
||||
// stdin
|
||||
// =======================
|
||||
|
||||
func __fstdin_read() -> String;
|
||||
|
||||
func __fstdin_readln() -> String;
|
||||
|
||||
|
||||
// =======================
|
||||
// value utilities
|
||||
// =======================
|
||||
|
||||
func __fvalue_type(value: Any) -> String;
|
||||
|
||||
func __fvalue_int_parse(str: String) -> Int;
|
||||
func __fvalue_int_from(value: Any) -> Int;
|
||||
|
||||
func __fvalue_double_parse(str: String) -> Double;
|
||||
func __fvalue_double_from(value: Any) -> Double;
|
||||
|
||||
func __fvalue_string_from(value: Any) -> String;
|
||||
|
||||
|
||||
// =======================
|
||||
// math
|
||||
// =======================
|
||||
|
||||
func __fmath_acos(x: Any) -> Double;
|
||||
func __fmath_acosh(x: Any) -> Double;
|
||||
func __fmath_asin(x: Any) -> Double;
|
||||
func __fmath_asinh(x: Any) -> Double;
|
||||
func __fmath_atan(x: Any) -> Double;
|
||||
func __fmath_atan2(y: Any, x: Any) -> Double;
|
||||
func __fmath_atanh(x: Any) -> Double;
|
||||
|
||||
func __fmath_ceil(x: Any) -> Double;
|
||||
func __fmath_cos(x: Any) -> Double;
|
||||
func __fmath_cosh(x: Any) -> Double;
|
||||
|
||||
func __fmath_exp(x: Any) -> Double;
|
||||
func __fmath_expm1(x: Any) -> Double;
|
||||
|
||||
func __fmath_fabs(x: Any) -> Double;
|
||||
func __fmath_floor(x: Any) -> Double;
|
||||
func __fmath_fmod(x: Any, y: Any) -> Double;
|
||||
|
||||
// returns List[Double, Int]
|
||||
func __fmath_frexp(x: Any) -> List;
|
||||
|
||||
func __fmath_gcd(a: Int, b: Int) -> Int;
|
||||
func __fmath_hypot(a: Any, b: Any) -> Double;
|
||||
|
||||
func __fmath_isequal(a: Any, b: Any) -> Bool;
|
||||
|
||||
func __fmath_log(x: Any) -> Double;
|
||||
func __fmath_log10(x: Any) -> Double;
|
||||
func __fmath_log1p(x: Any) -> Double;
|
||||
func __fmath_log2(x: Any) -> Double;
|
||||
|
||||
func __fmath_sin(x: Any) -> Double;
|
||||
func __fmath_sinh(x: Any) -> Double;
|
||||
|
||||
func __fmath_sqrt(x: Any) -> Double;
|
||||
|
||||
func __fmath_tan(x: Any) -> Double;
|
||||
func __fmath_tanh(x: Any) -> Double;
|
||||
|
||||
func __fmath_trunc(x: Any) -> Double;
|
||||
42
src/Module/Library/lang/lang.fig
Normal file
42
src/Module/Library/lang/lang.fig
Normal file
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
DO NOT IMPORT THIS FILE
|
||||
DO NOT IMPORT THIS FILE
|
||||
DO NOT IMPORT THIS FILE
|
||||
|
||||
Module `lang`
|
||||
|
||||
Visible to IDEs and documentation tools,
|
||||
NOT importable, NOT executable as a real module.
|
||||
|
||||
Library/lang/lang.fig
|
||||
|
||||
Copyright © 2025 PuqiAR. All rights reserved.
|
||||
*/
|
||||
|
||||
|
||||
// values
|
||||
|
||||
var null: Null;
|
||||
|
||||
var true: Bool;
|
||||
var false: Bool;
|
||||
|
||||
|
||||
// Error interface
|
||||
|
||||
public interface Error
|
||||
{
|
||||
toString() -> String;
|
||||
getErrorClass() -> String;
|
||||
getErrorMessage() -> String;
|
||||
}
|
||||
|
||||
public struct Any {}
|
||||
public struct Int {}
|
||||
public struct Null {}
|
||||
public struct String {}
|
||||
public struct Bool {}
|
||||
public struct Double {}
|
||||
public struct Function {}
|
||||
public struct List {}
|
||||
public struct Map {}
|
||||
@@ -87,7 +87,7 @@ public func fmod(x, y)
|
||||
|
||||
public func frexp(x) -> List
|
||||
{
|
||||
// return List {mantissa, exponent
|
||||
// return List {mantissa, exponent}
|
||||
return __fmath_frexp(x);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user