diff --git a/tools/generateASTNode.sh b/tools/generateASTNode.sh new file mode 100755 index 0000000..a8866ce --- /dev/null +++ b/tools/generateASTNode.sh @@ -0,0 +1,41 @@ +cd "$(dirname $0)"/../src/AST + +if [ "$1" == "" ]; then +exit 1 +fi + +touch $1.cpp +touch $1.h + +cat << EOF > $1.h +#pragma once +#include "ExprNode.h" + +class $1 final : public ExprNode +{ + public: + $1(); + ~$1(); + + llvm::Value* codegen(IRBuilder* generator) override; +}; +EOF + +cat << EOF > $1.cpp +#include "$1.h" + +$1::$1() + : ExprNode() +{ +} + +$1::~$1() +{ +} + +llvm::Value* $1::codegen(IRBuilder* generator) +{ + return llvm::ConstantInt::getSigned(llvm::IntegerType::getInt32Ty(generator->getBuilder()->getContext()), + 0); +} +EOF \ No newline at end of file