#pragma once #include #include #include #include namespace xlang { class EmitVisitor : public xlangBaseVisitor { std::ofstream output; size_t blockcount; size_t tmpcount; std::string last; std::vector loopstack; std::string tmp(); public: EmitVisitor(std::string_view outputfile); std::any visitFile(xlangParser::FileContext *ctx) override; std::any visitFunction(xlangParser::FunctionContext *ctx) override; std::any visitStatement(xlangParser::StatementContext *ctx) override; std::any visitCondition(xlangParser::ConditionContext *ctx) override; std::any visitBoolean(xlangParser::BooleanContext *ctx) override; std::any visitExpr(xlangParser::ExprContext *ctx) override; std::any visitTerm(xlangParser::TermContext *ctx) override; std::any visitFactor(xlangParser::FactorContext *ctx) override; std::any visitVariable(xlangParser::VariableContext *ctx) override; }; } // namespace xlang