[Feat] 详细区分左值(LvObject)与右值(RvObject -> ObjectPtr)

[Impl] 重构evaluator.cpp + hpp 全部
[Feat] 增加对于IndexExpr的解析
[Fix][Impl] 现在点运算符不由BinaryExpr负责,增加MemberExpr,单独实现解析
[Impl] 项目目录全部翻修, src/目录下单独文件夹放置每一个模块
This commit is contained in:
2025-12-24 17:51:49 +08:00
parent 3227230aa2
commit fc35368d85
70 changed files with 1558 additions and 1233 deletions

View File

@@ -27,16 +27,16 @@ Copyright (C) 2020-2025 PuqiAR
This software is licensed under the MIT License. See LICENSE.txt for details.
*/
#include <argparse/argparse.hpp>
#include <Utils/argparse/argparse.hpp>
#include <print>
#include <fstream>
#include <core.hpp>
#include <lexer.hpp>
#include <parser.hpp>
#include <evaluator.hpp>
#include <AstPrinter.hpp>
#include <errorLog.hpp>
#include <Core/core.hpp>
#include <Lexer/lexer.hpp>
#include <Parser/parser.hpp>
#include <Evaluator/evaluator.hpp>
#include <Utils/AstPrinter.hpp>
#include <Error/errorLog.hpp>
static size_t addressableErrorCount = 0;
static size_t unaddressableErrorCount = 0;
@@ -117,13 +117,13 @@ int main(int argc, char **argv)
// }
Fig::Parser parser(lexer);
std::vector<Fig::Ast::AstBase> ast;
std::vector<Fig::Ast::AstBase> asts;
std::vector<FString> sourceLines = splitSource(Fig::FString(source));
try
{
ast = parser.parseAll();
asts = parser.parseAll();
}
catch (const Fig::AddressableError &e)
{
@@ -150,10 +150,12 @@ int main(int argc, char **argv)
// printer.print(node);
// }
Fig::Evaluator evaluator(ast);
Fig::Evaluator evaluator;
evaluator.CreateGlobalContext();
evaluator.RegisterBuiltins();
try
{
evaluator.run();
evaluator.Run(asts);
}
catch (const Fig::AddressableError &e)
{