better error message

This commit is contained in:
crumbtoo
2023-11-29 11:11:07 -07:00
parent 1e7e881791
commit febc5a0252

View File

@@ -202,7 +202,7 @@ buildInitialHeap (Program ss) = mapAccumL allocateSc mempty compiled
| k `elem` domain = [Push n] | k `elem` domain = [Push n]
| otherwise = [PushGlobal k] | otherwise = [PushGlobal k]
where where
n = fromMaybe (error "unknown var") $ lookup k g n = fromMaybe (error $ "undeclared var: " <> k) $ lookup k g
domain = fmap fst g domain = fmap fst g
compileC g (IntE n) = [PushInt n] compileC g (IntE n) = [PushInt n]