diff --git a/2023a/minibasic/semantic/ast.hpp b/2023a/minibasic/semantic/ast.hpp
index 127dad65..c4314bcd 100644
--- a/2023a/minibasic/semantic/ast.hpp
+++ b/2023a/minibasic/semantic/ast.hpp
@@ -7,7 +7,7 @@
 
 #include "symbol.hpp"
 
-extern std::map<char, int> globals;
+extern std::vector<int> rt_stack;
 
 
 class AST {
@@ -39,6 +39,12 @@ class Decl : public AST {
   void printAST(std::ostream &out) const override {
     out << "Decl(" << var << ": " << type << ")";
   }
+  void allocate() const {
+    rt_stack.push_back(0);
+  }
+  void deallocate() const {
+    rt_stack.pop_back();
+  }
  private:
   char var;
   Type type;
@@ -96,13 +102,15 @@ class Let : public Stmt {
   void sem() override {
     STEntry *e = st.lookup(var);
     expr->check_type(e->type);
+    offset = e->offset;
   }
   void execute() const override {
-    globals[var] = expr->eval();
+    rt_stack[offset] = expr->eval();
   }
  private:
   char var;
   Expr *expr;
+  int offset;
 };
 
 class Print : public Stmt {
@@ -178,8 +186,9 @@ class Block : public Stmt {
     st.pop_scope();
   }
   void execute() const override {
-    for (Stmt *s : stmt_list)
-      s->execute();
+    for (Decl *d : decl_list) d->allocate();
+    for (Stmt *s : stmt_list) s->execute();
+    for (Decl *d : decl_list) d->deallocate();
   }
  private:
   std::vector<Decl *> decl_list;
@@ -212,6 +221,9 @@ class BinOp : public Expr {
       case '*': return expr1->eval() * expr2->eval();
       case '/': return expr1->eval() / expr2->eval();
       case '%': return expr1->eval() % expr2->eval();
+      case '<': return expr1->eval() < expr2->eval();
+      case '=': return expr1->eval() == expr2->eval();
+      case '>': return expr1->eval() > expr2->eval();
     }
     return 42;  // will never be reached...
   }
@@ -230,12 +242,14 @@ class Id : public Expr {
   void sem() override {
     STEntry *e = st.lookup(var);
     type = e->type;
+    offset = e->offset;
   }
   int eval() const override {
-    return globals[var];
+    return rt_stack[offset];
   }
  private:
   char var;
+  int offset;
 };
 
 class IntConst : public Expr {
diff --git a/2023a/minibasic/semantic/parser.y b/2023a/minibasic/semantic/parser.y
index 9c533136..6bbfb0d6 100644
--- a/2023a/minibasic/semantic/parser.y
+++ b/2023a/minibasic/semantic/parser.y
@@ -6,7 +6,7 @@
 
 SymbolTable st;
 
-std::map<char, int> globals;
+std::vector<int> rt_stack;
 %}
 
 %token T_begin "begin"
@@ -55,8 +55,8 @@ std::map<char, int> globals;
 program : block   {
 	auto prg = $1;
 	// std::cout << "AST: " << *prg << std::endl;
-	$1->sem();
-	// $1->execute(); 
+	prg->sem();
+	prg->execute();
 	delete prg;
     }
 ;
@@ -114,6 +114,6 @@ void yyerror(const char *msg) {
 
 int main() {
   int res = yyparse();
-  if (res == 0) printf("Successful semantic analysis\n");
+  // if (res == 0) printf("Successful semantic analysis\n");
   return res;
 }
diff --git a/2023a/minibasic/semantic/symbol.hpp b/2023a/minibasic/semantic/symbol.hpp
index fc46f939..38e6cbac 100644
--- a/2023a/minibasic/semantic/symbol.hpp
+++ b/2023a/minibasic/semantic/symbol.hpp
@@ -10,13 +10,14 @@ enum Type { TYPE_int, TYPE_bool };
 
 struct STEntry {
   Type type;
+  int offset;
   STEntry() {}
-  STEntry(Type t) : type(t) {}
+  STEntry(Type t, int o) : type(t), offset(o) {}
 };
 
 class Scope {
  public:
-  Scope() {}
+  Scope(int o = -1) : offset(o) {}
   STEntry *lookup(char c) {
     if (locals.find(c) == locals.end()) return nullptr;
     return &(locals[c]);
@@ -24,10 +25,14 @@ class Scope {
   void insert(char c, Type t) {
     if (locals.find(c) != locals.end())
       yyerror("Duplicate variable declaration");
-    locals[c] = STEntry(t);
+    locals[c] = STEntry(t, offset++);
+  }
+  int get_offset() {
+    return offset;
   }
  private:
   std::map<char, STEntry> locals;
+  int offset;
 };
 
 class SymbolTable {
@@ -44,7 +49,8 @@ class SymbolTable {
     scopes.back().insert(c, t);
   }
   void push_scope() {
-    scopes.push_back(Scope());
+    int o = scopes.empty() ? 0 : scopes.back().get_offset();
+    scopes.push_back(Scope(o));
   }
   void pop_scope() {
     scopes.pop_back();
