From 3e145bf08b1ffcccb4df8f2fc34f5bb95b5b250c Mon Sep 17 00:00:00 2001 From: Yann Herklotz Date: Wed, 8 Mar 2017 21:52:17 +0000 Subject: Adding extra test case and slight mod to classes --- c_compiler/src/declaration.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'c_compiler/src/declaration.cpp') diff --git a/c_compiler/src/declaration.cpp b/c_compiler/src/declaration.cpp index e2f27cc..7b924b3 100644 --- a/c_compiler/src/declaration.cpp +++ b/c_compiler/src/declaration.cpp @@ -30,7 +30,14 @@ void Declaration::printxml() const } void Declaration::printasm() const -{} +{ + if(init == nullptr) + std::cout << "\t.comm\t" << id << ",4,4" << std::endl; + else { + std::cout << "\t.data\n\t.globl\t" << id << std::endl; + std::cout << id << ":\n\t.word\t" << std::endl; + } +} void Declaration::addDeclaration(Declaration* _next_decl) { -- cgit