Simple shell script to generate a template ASTNode
This commit is contained in:
parent
3d2fa00db8
commit
4ff4f33828
41
tools/generateASTNode.sh
Executable file
41
tools/generateASTNode.sh
Executable file
@ -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
|
Loading…
Reference in New Issue
Block a user