2631f76da1
- Added Compiler class with methods for compiling programs, statements, and expressions. - Introduced Proto structure to hold compiled bytecode and constants. - Implemented expression compilation including literals, identifiers, and infix expressions. - Developed statement compilation for variable declarations and expression statements. - Created a VM class to execute compiled bytecode with support for arithmetic and comparison operations. - Added Object and Value classes for handling different data types and memory management. - Implemented String and Struct objects for enhanced data representation. - Established a parser for parsing variable declarations and statements. - Included tests for the VM and object representations.
35 lines
626 B
C++
35 lines
626 B
C++
/*!
|
|
@file src/Ast/Stmt/ExprStmt.hpp
|
|
@brief ExprStmt定义
|
|
@author PuqiAR (im@puqiar.top)
|
|
@date 2026-02-19
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <Ast/Base.hpp>
|
|
|
|
namespace Fig
|
|
{
|
|
struct ExprStmt final : public Stmt
|
|
{
|
|
Expr *expr;
|
|
|
|
ExprStmt()
|
|
{
|
|
type = AstType::ExprStmt;
|
|
}
|
|
|
|
ExprStmt(Expr *_expr) :
|
|
expr(_expr)
|
|
{
|
|
type = AstType::ExprStmt;
|
|
location = _expr->location;
|
|
}
|
|
|
|
virtual String toString() const override
|
|
{
|
|
return std::format("<ExprStmt: {}>", expr->toString());
|
|
}
|
|
};
|
|
} |