Skip to content

Commit

Permalink
Partially developed the Stmt class for AST.
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-6 committed Mar 3, 2024
1 parent 009efd0 commit e2342d9
Show file tree
Hide file tree
Showing 5 changed files with 419 additions and 20 deletions.
27 changes: 26 additions & 1 deletion compiler/ast/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,36 @@ class Compiler::Ast {
~Ast();

class NameInfo;
class FuncDecl;
class Decl;
class Expr;
class Stmt;
class Type;

class DeclStmt;
class NullStmt;
class CompoundStmt;
class SwitchCase;
class CaseStmt;
class DefaultStmt;
class LabelStmt;
class AttributedStmt;
class IfStmt;
class SwitchStmt;
class WhileStmt;
class DoStmt;
class ForStmt;
class GotoStmt;
class IndirectGotoStmt;
class ContinueStmt;
class BreakStmt;
class ReturnStmt;
class AsmStmt;
class SEHExceptStmt;
class SEHFinallyStmt;
class SEHTryStmt;
class SEHLeaveStmt;
class CapturedStmt;

private:
// TODO: Waiting for development.
};
Expand Down
17 changes: 3 additions & 14 deletions compiler/ast/decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,10 @@

namespace Aq {
// TODO: Decl AST
class Compiler::Ast::FuncDecl {
class Compiler::Ast::Decl {
public:
FuncDecl();
~FuncDecl();

FuncDecl(const FuncDecl&) = default;
FuncDecl(FuncDecl&&) noexcept = default;
FuncDecl& operator=(const FuncDecl&) = default;
FuncDecl& operator=(FuncDecl&&) noexcept = default;

private:
// std::string name;
// std::vector<Expr*> args;
// Stmt* body;
// TODO: Add more.
Decl();
~Decl();
};
} // namespace Aq

Expand Down
3 changes: 2 additions & 1 deletion compiler/ast/name_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// This program is licensed under the AQ License. You can find the AQ license in
// the root directory.

#include "compiler/ast/ast.h"
#include "compiler/ast/name_info.h"

#include "compiler/ast/ast.h"

// TODO: AST
81 changes: 79 additions & 2 deletions compiler/ast/stmt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,84 @@
// This program is licensed under the AQ License. You can find the AQ license in
// the root directory.

#include "compiler/ast/ast.h"
#include "compiler/ast/stmt.h"

// TODO: AST
#include "compiler/ast/ast.h"

namespace Aq {
Compiler::Ast::Stmt::Stmt() = default;
Compiler::Ast::Stmt::~Stmt() = default;

Compiler::Ast::DeclStmt::DeclStmt() = default;
Compiler::Ast::DeclStmt::~DeclStmt() = default;

Compiler::Ast::NullStmt::NullStmt() = default;
Compiler::Ast::NullStmt::~NullStmt() = default;

Compiler::Ast::CompoundStmt::CompoundStmt() = default;
Compiler::Ast::CompoundStmt::~CompoundStmt() = default;

Compiler::Ast::SwitchCase::SwitchCase() = default;
Compiler::Ast::SwitchCase::~SwitchCase() = default;

Compiler::Ast::CaseStmt::CaseStmt() = default;
Compiler::Ast::CaseStmt::~CaseStmt() = default;

Compiler::Ast::DefaultStmt::DefaultStmt() = default;
Compiler::Ast::DefaultStmt::~DefaultStmt() = default;

Compiler::Ast::LabelStmt::LabelStmt() = default;
Compiler::Ast::LabelStmt::~LabelStmt() = default;

Compiler::Ast::AttributedStmt::AttributedStmt() = default;
Compiler::Ast::AttributedStmt::~AttributedStmt() = default;

Compiler::Ast::IfStmt::IfStmt() = default;
Compiler::Ast::IfStmt::~IfStmt() = default;

Compiler::Ast::SwitchStmt::SwitchStmt() = default;
Compiler::Ast::SwitchStmt::~SwitchStmt() = default;

Compiler::Ast::WhileStmt::WhileStmt() = default;
Compiler::Ast::WhileStmt::~WhileStmt() = default;

Compiler::Ast::DoStmt::DoStmt() = default;
Compiler::Ast::DoStmt::~DoStmt() = default;

Compiler::Ast::ForStmt::ForStmt() = default;
Compiler::Ast::ForStmt::~ForStmt() = default;

Compiler::Ast::GotoStmt::GotoStmt() = default;
Compiler::Ast::GotoStmt::~GotoStmt() = default;

Compiler::Ast::IndirectGotoStmt::IndirectGotoStmt() = default;
Compiler::Ast::IndirectGotoStmt::~IndirectGotoStmt() = default;

Compiler::Ast::ContinueStmt::ContinueStmt() = default;
Compiler::Ast::ContinueStmt::~ContinueStmt() = default;

Compiler::Ast::BreakStmt::BreakStmt() = default;
Compiler::Ast::BreakStmt::~BreakStmt() = default;

Compiler::Ast::ReturnStmt::ReturnStmt() = default;
Compiler::Ast::ReturnStmt::~ReturnStmt() = default;

Compiler::Ast::AsmStmt::AsmStmt() = default;
Compiler::Ast::AsmStmt::~AsmStmt() = default;

Compiler::Ast::SEHExceptStmt::SEHExceptStmt() = default;
Compiler::Ast::SEHExceptStmt::~SEHExceptStmt() = default;

Compiler::Ast::SEHFinallyStmt::SEHFinallyStmt() = default;
Compiler::Ast::SEHFinallyStmt::~SEHFinallyStmt() = default;

Compiler::Ast::SEHTryStmt::SEHTryStmt() = default;
Compiler::Ast::SEHTryStmt::~SEHTryStmt() = default;

Compiler::Ast::SEHLeaveStmt::SEHLeaveStmt() = default;
Compiler::Ast::SEHLeaveStmt::~SEHLeaveStmt() = default;

Compiler::Ast::CapturedStmt::CapturedStmt() = default;
Compiler::Ast::CapturedStmt::~CapturedStmt() = default;

} // namespace Aq
Loading

0 comments on commit e2342d9

Please sign in to comment.