(*simbolna tabela*)

type symtab = (string, int) Hashtbl.t

let create_symtab () : symtab = 
  Hashtbl.create 64

let add_symbol (tab : symtab) (label : string) (addr : int)  = 
  if Hashtbl.mem tab label then
    failwith "Duplicate symbol in simtab"
  else 
   Hashtbl.add tab label addr

  let find_symbol (tab : symtab) (label : string) : int = 
    try
      Hashtbl.find tab label
    with
      | Not_found -> failwith (Printf.sprintf "[SimTab] Symbol not found: '%s'." label) 