aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/src
diff options
context:
space:
mode:
Diffstat (limited to 'c_compiler/src')
-rw-r--r--c_compiler/src/base.cpp7
-rw-r--r--c_compiler/src/c_parser.y236
-rw-r--r--c_compiler/src/compiler_main.cpp5
-rw-r--r--c_compiler/src/declaration.cpp51
-rw-r--r--c_compiler/src/expression.cpp9
-rw-r--r--c_compiler/src/function.cpp51
-rw-r--r--c_compiler/src/initializer.cpp22
-rw-r--r--c_compiler/src/primitives.cpp35
-rw-r--r--c_compiler/src/statement.cpp126
-rw-r--r--c_compiler/src/translation_unit.cpp32
10 files changed, 477 insertions, 97 deletions
diff --git a/c_compiler/src/base.cpp b/c_compiler/src/base.cpp
deleted file mode 100644
index f2d9029..0000000
--- a/c_compiler/src/base.cpp
+++ /dev/null
@@ -1,7 +0,0 @@
-#include "ast.hpp"
-
-
-// Base List definition
-
-BaseList::BaseList()
-
diff --git a/c_compiler/src/c_parser.y b/c_compiler/src/c_parser.y
index 7a3899b..2864907 100644
--- a/c_compiler/src/c_parser.y
+++ b/c_compiler/src/c_parser.y
@@ -18,13 +18,15 @@ void yyerror(const char *);
Node* node;
TranslationUnit* trans_unit;
Function* function;
+ Statement* statement;
+ Declaration* declaration;
+ Expression* expression;
Type* type;
Initializer* initializer;
- Declaration* declaration;
double number;
std::string* string;
}
-
+
%token T_TYPE_SPEC T_TYPE_QUAL T_STRG_SPEC T_IDENTIFIER T_SC T_CMA T_LRB T_LCB T_RCB
T_LSB T_RSB T_QU T_COL T_LOG_OR T_LOG_AND T_OR T_XOR T_AND T_EQUALITY_OP
T_REL_OP T_SHIFT_OP T_MULT T_DIV T_REM T_TILDE T_NOT T_DOT T_ARROW T_INCDEC
@@ -33,6 +35,7 @@ void yyerror(const char *);
%nonassoc T_RRB
%nonassoc T_ELSE
+
%type <node> ExternalDeclaration
@@ -40,18 +43,30 @@ void yyerror(const char *);
%type <function> FunctionDefinition
-%type <declaration> Parameter Declaration InitDeclaratorList InitDeclarator ParameterList
+%type <statement> StatementList Statement CompoundStatement CompoundStatement_2
+ SelectionStatement
+ ExpressionStatement JumpStatement IterationStatement
+
+%type <declaration> ParameterList Parameter DeclarationList Declaration InitDeclaratorList
+ InitDeclarator
+ IdentifierList
-%type <type> DeclarationSpec
+%type <expression> Expression AssignmentExpression ConditionalExpression LogicalOrExpression
+ LogicalAndExpression InclusiveOrExpression ExclusiveOrExpression
+ AndExpression EqualityExpression RelationalExpression ShiftExpression
+ AdditiveExpression MultiplicativeExpression CastExpression UnaryExpression
+ PostfixExpression PostfixExpression2 ArgumentExpressionList PrimaryExpression
+
+%type <type> DeclarationSpec DeclarationSpec_T
%type <string> Declarator DirectDeclarator
+
+%type <initializer> Constant
%type <number> T_INT_CONST
-
-%type <initializer> Initializer
-%type <string> T_IDENTIFIER T_ASSIGN_OPER T_EQ T_AND T_ADDSUB_OP T_TILDE T_NOT
- T_MULT T_DIV T_REM
+%type <string> T_IDENTIFIER ASSIGN_OPER T_ASSIGN_OPER T_EQ T_AND T_ADDSUB_OP T_TILDE T_NOT
+ T_MULT T_DIV T_REM MultDivRemOP UnaryOperator
%start ROOT
@@ -61,11 +76,11 @@ ROOT:
TranslationUnit { g_root = $1; }
;
-// TRANSLATION UNIT
+// EXTERNAL DEFINITION
TranslationUnit:
ExternalDeclaration { $$ = new TranslationUnit($1); }
- | TranslationUnit ExternalDeclaration { $$->push($2); }
+| TranslationUnit ExternalDeclaration { $$->push($2); }
;
ExternalDeclaration:
@@ -76,13 +91,13 @@ ExternalDeclaration:
// FUNCTION DEFINITION
FunctionDefinition:
- DeclarationSpec T_IDENTIFIER T_LRB ParameterList T_RRB T_SC { $$ = new Function(*$2, $4); }
+ DeclarationSpec T_IDENTIFIER T_LRB ParameterList T_RRB CompoundStatement { $$ = new Function(*$2, $4, $6); }
;
ParameterList:
%empty { $$ = new Declaration(); }
| Parameter { $$ = $1; }
- | ParameterList T_CMA Parameter { $3->addDeclaration($$); $$ = $3; }
+ | ParameterList T_CMA Parameter { $3->addDeclaration($$); $$ = $3;}
;
Parameter:
@@ -91,6 +106,11 @@ Parameter:
// Declaration
+DeclarationList:
+ Declaration { $$ = $1; }
+ | DeclarationList Declaration { $2->addDeclaration($$); $$ = $2; }
+ ;
+
Declaration:
DeclarationSpec InitDeclaratorList T_SC { $$ = $2; }
;
@@ -107,19 +127,15 @@ DeclarationSpec_T:
;
InitDeclaratorList:
- InitDeclarator { $$ = $1; }
- | InitDeclaratorList T_CMA InitDeclarator { $3->addDeclaration($$); $$ = $3; }
+ InitDeclarator { $$ = new Declaration(*$1); }
+ | InitDeclaratorList T_CMA InitDeclarator { $3->addList($$); $$ = $3; }
;
InitDeclarator:
Declarator { $$ = new Declaration(*$1); }
- | Declarator T_EQ Initializer { $$ = new Declaration(*$1); }
+ | Declarator T_EQ AssignmentExpression { $$ = new Declaration(*$1); }
;
-Initializer:
- T_INT_CONST { $$ = new Initializer(); }
- ;
-
Declarator:
DirectDeclarator { $$ = $1; }
| T_MULT DirectDeclarator { $$ = $2; }
@@ -127,6 +143,188 @@ Declarator:
DirectDeclarator:
T_IDENTIFIER { $$ = $1; }
+ | T_LRB Declarator T_RRB { $$ = $2; }
+ | DirectDeclarator T_LSB ConditionalExpression T_RSB { $$ = $1; }
+ | DirectDeclarator T_LSB T_RSB { $$ = $1; }
+ | DirectDeclarator T_LRB ParameterList T_RRB { $$ = $1; }
+ | DirectDeclarator T_LRB IdentifierList T_RRB { $$ = $1; }
+ ;
+
+IdentifierList:
+ T_IDENTIFIER { $$ = new Declaration(); }
+ | IdentifierList T_CMA T_IDENTIFIER { $$ = new Declaration(); }
+
+// Statement
+
+StatementList:
+ Statement { $$ = $1; }
+ | StatementList Statement { $2->addStatement($$); $$ = $2; }
+ ;
+
+Statement:
+ CompoundStatement { $$ = $1; }
+ | SelectionStatement { $$ = $1; }
+ | ExpressionStatement { $$ = $1; }
+ | JumpStatement { $$ = $1; }
+ | IterationStatement { $$ = $1; }
+ ;
+
+CompoundStatement:
+ T_LCB CompoundStatement_2 { $$ = $2; }
+ ;
+
+CompoundStatement_2:
+ T_RCB { $$ = new CompoundStatement; }
+ | DeclarationList T_RCB { $$ = new CompoundStatement($1); }
+ | DeclarationList StatementList T_RCB { $$ = new CompoundStatement($1, $2); }
+ | StatementList T_RCB { $$ = new CompoundStatement($1); }
+ ;
+
+SelectionStatement:
+ T_IF T_LRB Expression T_RRB Statement { $$ = new SelectionStatement($5); }
+ | T_IF T_LRB Expression T_RRB Statement T_ELSE Statement { $$ = new SelectionStatement($5, $7); }
+ ;
+
+ExpressionStatement:
+ T_SC { $$ = new ExpressionStatement(); }
+| Expression T_SC { $$ = new ExpressionStatement(); }
+ ;
+
+JumpStatement:
+ T_RETURN ExpressionStatement { $$ = new JumpStatement(); }
+ ;
+
+IterationStatement:
+ T_WHILE T_LRB Expression T_RRB Statement { $$ = $5; }
+ | T_DO Statement T_WHILE T_LRB Expression T_RRB T_SC { $$ = $2; }
+ | T_FOR T_LRB Expression T_SC Expression T_SC Expression T_RRB Statement { $$ = $9; }
+ ;
+
+// Expressions
+
+Expression:
+ AssignmentExpression { $$ = $1; }
+ ;
+
+AssignmentExpression:
+ ConditionalExpression { $$ = $1; }
+ | UnaryExpression ASSIGN_OPER AssignmentExpression { $$ = $1; }
+ ;
+
+ASSIGN_OPER:
+ T_ASSIGN_OPER { ; }
+ | T_EQ { ; }
+ ;
+
+ConditionalExpression:
+ LogicalOrExpression { $$ = $1; }
+ | LogicalOrExpression T_QU Expression T_COL ConditionalExpression { $$ = $1; }
+ ;
+
+LogicalOrExpression:
+ LogicalAndExpression { $$ = $1; }
+ | LogicalOrExpression T_LOG_OR LogicalAndExpression { $$ = $3; }
+ ;
+
+LogicalAndExpression:
+ InclusiveOrExpression { $$ = $1; }
+ | LogicalAndExpression T_LOG_AND InclusiveOrExpression { $$ = $3; }
+ ;
+
+InclusiveOrExpression:
+ ExclusiveOrExpression { $$ = $1; }
+ | InclusiveOrExpression T_OR ExclusiveOrExpression { $$ = $3; }
+ ;
+
+ExclusiveOrExpression:
+ AndExpression { $$ = $1; }
+ | ExclusiveOrExpression T_XOR AndExpression { $$ = $3; }
+ ;
+
+AndExpression:
+ EqualityExpression { $$ = $1; }
+ | AndExpression T_AND EqualityExpression { $$ = $3; }
+ ;
+
+EqualityExpression:
+ RelationalExpression { $$ = $1; }
+ | EqualityExpression T_EQUALITY_OP RelationalExpression { $$ = $3; }
+ ;
+
+RelationalExpression:
+ ShiftExpression { $$ = $1; }
+ | RelationalExpression T_REL_OP ShiftExpression { $$ = $3; }
+ ;
+
+ShiftExpression:
+ AdditiveExpression { $$ = $1; }
+ | ShiftExpression T_SHIFT_OP AdditiveExpression { $$ = $3; }
+ ;
+
+AdditiveExpression:
+ MultiplicativeExpression { $$ = $1; }
+ | AdditiveExpression T_ADDSUB_OP MultiplicativeExpression { $$ = $3; }
+ ;
+
+MultiplicativeExpression:
+ CastExpression { $$ = $1; }
+ | MultiplicativeExpression MultDivRemOP CastExpression { $$ = $3; }
+ ;
+
+MultDivRemOP:
+ T_MULT { $$ = $1; }
+ | T_DIV { $$ = $1; }
+ | T_REM { $$ = $1; }
+ ;
+
+CastExpression:
+ UnaryExpression { $$ = $1; }
+ | T_LRB T_TYPE_SPEC T_RRB CastExpression { $$ = $4; }
+ ;
+
+UnaryExpression:
+ PostfixExpression { $$ = $1; }
+ | T_INCDEC UnaryExpression { $$ = $2; }
+ | UnaryOperator CastExpression { $$ = $2; }
+ | T_SIZEOF UnaryExpression { $$ = $2; }
+ | T_SIZEOF T_LRB T_TYPE_SPEC T_RRB { $$ = new Expression(); }
+ ;
+
+UnaryOperator:
+ T_AND { $$ = $1; }
+ | T_ADDSUB_OP { $$ = $1; }
+ | T_MULT { $$ = $1; }
+ | T_TILDE { $$ = $1; }
+ | T_NOT { $$ = $1; }
+ ;
+
+PostfixExpression:
+ PrimaryExpression { $$ = $1; }
+ | PostfixExpression T_LSB Expression T_RSB { $$ = $3; }
+ | PostfixExpression T_LRB PostfixExpression2 { $$ = $3; }
+ | PostfixExpression T_DOT T_IDENTIFIER { $$ = new Expression(); }
+ | PostfixExpression T_ARROW T_IDENTIFIER { $$ = new Expression(); }
+ | PostfixExpression T_INCDEC { $$ = new Expression(); }
+ ;
+
+PostfixExpression2:
+ T_RRB { $$ = new Expression(); }
+ | ArgumentExpressionList T_RRB { $$ = new Expression; }
+ ;
+
+ArgumentExpressionList:
+ AssignmentExpression { $$ = new Expression; }
+ | ArgumentExpressionList T_CMA AssignmentExpression { $$ = new Expression; }
+ ;
+
+PrimaryExpression:
+ T_IDENTIFIER { $$ = new Expression(); }
+ | Constant { $$ = new Expression($1); }
+ | T_LRB Expression T_RRB { $$ = $2; }
+ ;
+
+Constant:
+ T_INT_CONST { $$ = new Initializer(); }
;
%%
diff --git a/c_compiler/src/compiler_main.cpp b/c_compiler/src/compiler_main.cpp
index 8dce76f..a4df8a7 100644
--- a/c_compiler/src/compiler_main.cpp
+++ b/c_compiler/src/compiler_main.cpp
@@ -2,10 +2,11 @@
#include <iostream>
-int main(int argc, char *argv[]) {
+int main(int argc, char *argv[])
+{
TranslationUnit* ast = parseAST();
- ast->print();
+ ast->printxml();
return 0;
}
diff --git a/c_compiler/src/declaration.cpp b/c_compiler/src/declaration.cpp
new file mode 100644
index 0000000..5341b5b
--- /dev/null
+++ b/c_compiler/src/declaration.cpp
@@ -0,0 +1,51 @@
+#include "ast.hpp"
+
+
+// Declaration definition
+
+Declaration::Declaration(const std::string& _id)
+ : id(_id) {}
+
+void Declaration::print() const
+{
+ if(next_decl != nullptr)
+ next_decl->print();
+
+ if(id != "")
+ std::cout << id << std::endl;
+}
+
+void Declaration::printxml() const
+{
+ if(next_decl != nullptr)
+ next_decl->printxml();
+
+ if(decl_list != nullptr) {
+ decl_list->printxml();
+ }
+
+ if(id != "")
+ std::cout << "<Variable id=\""<< id << "\" />" << std::endl;
+}
+
+void Declaration::printasm() const {}
+
+void Declaration::addDeclaration(Declaration* _next_decl)
+{
+ next_decl = _next_decl;
+}
+
+void Declaration::addList(Declaration* _next_decl)
+{
+ decl_list = _next_decl;
+}
+
+Declaration* Declaration::getNext() const
+{
+ return next_decl;
+}
+
+std::string Declaration::getId() const
+{
+ return id;
+}
diff --git a/c_compiler/src/expression.cpp b/c_compiler/src/expression.cpp
index cf2b58f..5eab857 100644
--- a/c_compiler/src/expression.cpp
+++ b/c_compiler/src/expression.cpp
@@ -3,9 +3,8 @@
// Expression definition
-Expression::Expression(const Base* _expr)
- : BaseNode(_expr) {}
+Expression::Expression(const Node* expr) {}
-void Expression::printasm() const {
- leftNode->printasm();
-}
+void Expression::print() const {}
+void Expression::printxml() const {}
+void Expression::printasm() const {}
diff --git a/c_compiler/src/function.cpp b/c_compiler/src/function.cpp
index 420c782..a132280 100644
--- a/c_compiler/src/function.cpp
+++ b/c_compiler/src/function.cpp
@@ -1,18 +1,47 @@
#include "ast.hpp"
-Function::Function(const std::string& _id, const BaseList* _param_list,
- const BaseNode* _comp_statement)
- : BaseNode(_param_list, _comp_statement), id(_id) {}
-void Function::printxml() const {
+// Function definition
+
+Function::Function(const std::string& _id, Declaration* _parameter_list, Statement* _statement)
+ : id(_id), parameter_list(_parameter_list), statement(_statement)
+{}
+
+void Function::print() const
+{
+ std::cout << id << std::endl;
+
+ if(parameter_list != nullptr)
+ parameter_list->print();
+
+ if(statement != nullptr)
+ statement->print();
+}
+
+void Function::printxml() const
+{
std::cout << "<Function id=\"" << id << "\">" << std::endl;
- leftNode->printxml();
- rightNode->printxml();
+
+ Declaration* parameter = parameter_list;
+ std::vector<std::string> parameter_vec;
+
+ while(parameter != nullptr) {
+ if(parameter->getId() != "")
+ parameter_vec.push_back(parameter->getId());
+ parameter = parameter->getNext();
+ }
+
+ for(std::vector<std::string>::reverse_iterator itr = parameter_vec.rbegin();
+ itr != parameter_vec.rend(); ++itr) {
+
+ std::cout << "<Parameter id=\"" << *itr << "\" />" << std::endl;
+ }
+
+ if(statement != nullptr)
+ statement->printxml();
+
std::cout << "</Function>" << std::endl;
}
-void Function::printasm() const {
- std::cout << id << ":\n\taddiu\t$sp,$sp,-24\n\tsw\t$fp,20($sp)\n\tmove\t$fp,$sp" << std::endl;
- rightNode->printasm();
- std::cout << "\tmove\t$sp,$fp\n\tlw\t$fp,20($sp)\n\taddiu\t$sp,$sp,24\n\tjr\t$31\n\tnop" << std::endl;
-}
+void Function::printasm() const
+{}
diff --git a/c_compiler/src/initializer.cpp b/c_compiler/src/initializer.cpp
new file mode 100644
index 0000000..61a0413
--- /dev/null
+++ b/c_compiler/src/initializer.cpp
@@ -0,0 +1,22 @@
+#include "ast.hpp"
+
+
+// Initializer definition
+
+Initializer::Initializer() {}
+
+void Initializer::print() const {}
+
+void Initializer::printxml() const {}
+
+void Initializer::printasm() const {}
+
+
+// Integer definition
+
+Integer::Integer() : Initializer() {}
+
+
+// String Literal definition
+
+StringLiteral::StringLiteral() : Initializer() {}
diff --git a/c_compiler/src/primitives.cpp b/c_compiler/src/primitives.cpp
deleted file mode 100644
index e3ec0eb..0000000
--- a/c_compiler/src/primitives.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
-#include "ast.hpp"
-
-
-// Parameter list definition (used in functions)
-
-ParamList::ParamList() : BaseList() {}
-
-ParamList::ParamList(const Base* _param) : BaseList(_param) {}
-
-
-// Declarator defintion, used when declaring a variable
-
-Declarator::Declarator(const std::string& _id) : BasePrimitive(_id) {}
-
-void Declarator::printxml() const {
- std::cout << "<Variable id=\"" << id << "\" />" << std::endl;
-}
-
-
-// Parameter class defition
-
-Parameter::Parameter(const std::string& _id) : BasePrimitive(_id) {}
-
-void Parameter::printxml() const {
- std::cout << "<Parameter id=\"" << id << "\" />" << std::endl;
-}
-
-
-// Immediate class definition, used when loading an immediate value
-
-Immediate::Immediate(const int32_t& _imm) : BasePrimitive(), imm(_imm) {}
-
-void Immediate::printasm() const {
- std::cout << "\tli\t$2," << imm << "\n\tsw\t$2,8($fp)" << std::endl;
-}
diff --git a/c_compiler/src/statement.cpp b/c_compiler/src/statement.cpp
index e828eaa..28bd981 100644
--- a/c_compiler/src/statement.cpp
+++ b/c_compiler/src/statement.cpp
@@ -3,51 +3,141 @@
// General base Statement definition
-Statement::Statement(const Base* _left, const Base* _right)
- : BaseNode(_left, _right) {}
+Statement::Statement(Statement* statement)
+ : next_statement(statement) {}
+void Statement::print() const
+{
+ if(next_statement != nullptr)
+ next_statement->print();
+}
-// Statement list definition
+void Statement::printxml() const
+{
+ if(next_statement != nullptr)
+ next_statement->printxml();
+}
-StatementList::StatementList(const Base* _statement)
- : BaseList(_statement) {}
+void Statement::printasm() const
+{
+ if(next_statement != nullptr)
+ next_statement->printasm();
+}
// Compound Statement definition
-CompoundStatement::CompoundStatement(const Base* _dec, const Base* _statement)
- : Statement(_dec, _statement) {}
+CompoundStatement::CompoundStatement(Declaration* decl, Statement* statement)
+ : Statement(), m_decl(decl), m_statement(statement) {}
+
+CompoundStatement::CompoundStatement(Statement* statement)
+ : m_statement(statement) {}
+
+void CompoundStatement::print() const
+{
+ if(m_decl != nullptr)
+ m_decl->print();
+
+ if(m_statement != nullptr)
+ m_statement->print();
+}
-void CompoundStatement::printxml() const {
+void CompoundStatement::printxml() const
+{
+ if(next_statement != nullptr)
+ next_statement->printxml();
+
std::cout << "<Scope>" << std::endl;
- leftNode->printxml();
- rightNode->printxml();
+
+ if(m_decl != nullptr)
+ m_decl->printxml();
+
+ if(m_statement != nullptr)
+ m_statement->printxml();
+
std::cout << "</Scope>" << std::endl;
}
+void CompoundStatement::printasm() const
+{}
+
// Selection Statement definition
-SelectionStatement::SelectionStatement(const Base* _if, const Base* _else)
- : Statement(_if, _else) {}
+SelectionStatement::SelectionStatement(Statement* _if, Statement* _else)
+ : Statement(), m_if(_if), m_else(_else) {}
+
+void SelectionStatement::print() const
+{
+ m_if->print();
+ m_else->print();
+}
+
+void SelectionStatement::printxml() const
+{
+ if(next_statement != nullptr)
+ next_statement->printxml();
+ if(m_if != nullptr)
+ m_if->printxml();
+ if(m_else != nullptr)
+ m_else->printxml();
+}
+
+void SelectionStatement::printasm() const
+{}
// Expression Statement definition
-ExpressionStatement::ExpressionStatement(const Base* _expr)
- : Statement(_expr) {}
+ExpressionStatement::ExpressionStatement(Expression* expr)
+ : Statement(), m_expr(expr) {}
+
+void ExpressionStatement::print() const
+{}
+
+void ExpressionStatement::printxml() const
+{}
+
+void ExpressionStatement::printasm() const
+{}
// Jump Statement definition
-JumpStatement::JumpStatement(const Base* _el) : Statement(_el) {}
+JumpStatement::JumpStatement(Expression* expr)
+ : m_expr(expr) {}
+
+void JumpStatement::print() const
+{}
-void JumpStatement::printasm() const {
- leftNode->printasm();
+void JumpStatement::printxml() const
+{
+ if(next_statement != nullptr)
+ next_statement->printxml();
+}
+
+void JumpStatement::printasm() const
+{
+ m_expr->printasm();
std::cout << "\tlw\t$2,8($fp)" << std::endl;
}
// Iteration Statement definition
-IterationStatement::IterationStatement(const Base* _el) : Statement(_el) {}
+IterationStatement::IterationStatement(Statement* statement)
+ : m_statement(statement) {}
+
+void IterationStatement::print() const
+{}
+
+void IterationStatement::printxml() const
+{
+ if(next_statement != nullptr)
+ next_statement->printxml();
+ if(m_statement != nullptr)
+ m_statement->printxml();
+}
+
+void IterationStatement::printasm() const
+{}
diff --git a/c_compiler/src/translation_unit.cpp b/c_compiler/src/translation_unit.cpp
new file mode 100644
index 0000000..c1e4c13
--- /dev/null
+++ b/c_compiler/src/translation_unit.cpp
@@ -0,0 +1,32 @@
+#include "ast.hpp"
+
+
+// Translation Unit definition
+
+TranslationUnit::TranslationUnit(Node* decl) {
+ push(decl);
+}
+
+void TranslationUnit::print() const {
+ for(auto& node : translation_unit) {
+ node->print();
+ }
+}
+
+void TranslationUnit::printxml() const {
+ std::cout << "<?xml version=\"1.0\"?>\n<Program>" << std::endl;
+ for(auto& node : translation_unit) {
+ node->printxml();
+ }
+ std::cout << "</Program>" << std::endl;
+}
+
+void TranslationUnit::printasm() const {
+ for(auto& node : translation_unit) {
+ node->printasm();
+ }
+}
+
+void TranslationUnit::push(Node* decl) {
+ translation_unit.push_back(decl);
+}