        
alreadyDefinedPtr v = do
  vars <- use (frame.ptrVars)
  return $ case lookup v vars of
    Nothing -> False
    Just _  -> True
               
defineVar var@(Var v) = do
  defd <- alreadyDefinedVar var
  when defd (error $ "already defined var: " ++ v)
  reg <- use (frame.
lookupVar :: Var -> State CompileState Reg
lookupVar var@(Var s) = do
  vars <- use (frame.intVars)
  case lookup var vars of
    Nothing -> error $ "undefined variable: " ++ s
    Just rg -> return rg

-- ポインタ変数を，シンボルテーブルから引っ張ってくる．
lookupVar var@(Var s) = do
  vars <- use (frame.intVars)
  case lookup var vars of
    Nothing -> error $ "undefined variable: " ++ s
    Just rg -> return rg

-- ポインタ変数を，シンボルテーブルから引っ張ってくる．