From a26f0f29c02bfb4ec56781397d60abeb498b8c12 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sat, 26 Nov 2022 13:35:19 +0100 Subject: massive cleanup --- app/Compiler.hs | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'app/Compiler.hs') diff --git a/app/Compiler.hs b/app/Compiler.hs index ecbd003..3c98d70 100644 --- a/app/Compiler.hs +++ b/app/Compiler.hs @@ -2,19 +2,11 @@ module Compiler where import Data.Char (isUpper) import Data.Containers.ListUtils (nubOrd) -import Data.List +import Data.List (elemIndex) import qualified Data.Map as M import Code (Code, Datum(..), Instr(..)) -import IR (Id(..), PrlgInt(..), PrlgStr(..), StrTable(..), strtablize) - -internPrlg :: StrTable -> PrlgStr -> (StrTable, PrlgInt) -internPrlg = go - where - go t (LiteralS str) = LiteralI <$> strtablize t str - go t (CallS str ps) = - let (t', i) = strtablize t str - in CallI (Id i $ length ps) <$> mapAccumL go t' ps +import IR (Id(..), PrlgInt(..), StrTable(..)) varname :: String -> Bool varname ('_':_) = True -- cgit v1.2.3