v0.4.3-alpha

[Fix] 函数调用时参数类型求值使用错误作用域的问题
[Fix] 结构体定义中不可以使用自身类型的bug
[Fix] import导致的重定义bug
[Impl] Parser的precedence调整

[Feat] 支持运算符重载, impl Operator for xxx {} 具体见 lang.fig中解释
[Feat] 新增标准库 std.test
[Feat] 新增内置函数 type,接收一个参数,返回该参数的类型(value.type改名value._type)
        推荐使用该函数替换 value._type
[Feat] 新增转换运算符 as,转换失败时抛出TypeError,支持任意类型到String、部分类型到Int, Double等等转换
        TypeError实现了Error interface,可被用户catch
        推荐使用该feat或与std.value标准库结合
[Feat] 抛出实现Error interface的错误现在会有不一样的log
[Feat] import增加cache(ast + source lines),但import一个module每次会得到不同对象而不是复用,请注意
This commit is contained in:
2026-02-04 19:12:18 +08:00
parent e8aed221de
commit da1a8e04de
4 changed files with 56 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
import std.io;
import token {Token, TokenType};
import tokenizer {Tokenizer};

View File

@@ -0,0 +1,31 @@
/*
Example code: FigFig
Token.fig
Copyright (C) 2020-2026 PuqiAR
*/
struct _TokenTypes
{
public EOF = -1;
public Identifier = 0;
public StringLiteral = 1;
public NumberLiteral = 2;
public True = 3;
public False = 4;
public Null = 5;
public Plus = 6;
public Minus = 7;
public Asterisk = 8;
public Slash = 9;
}
public const TokenType := new _TokenTypes{};
public struct Token
{
public literal: String = "";
public type: Int = TokenType.EOF;
}

View File

@@ -0,0 +1,20 @@
/*
Example code: FigFig
Tokenizer.fig
Copyright (C) 2020-2026 PuqiAR
*/
import token {Token, TokenType};
public struct Tokenizer
{
src: String = "";
public func TokenizeAll() -> List
{
var output := [];
return output;
}
}

View File

@@ -4,7 +4,7 @@
#include <cstdint> #include <cstdint>
#include <string_view> #include <string_view>
#define __FCORE_VERSION "0.4.2-alpha" #define __FCORE_VERSION "0.4.3-alpha"
#if defined(_WIN32) #if defined(_WIN32)
#define __FCORE_PLATFORM "Windows" #define __FCORE_PLATFORM "Windows"