diff options
Diffstat (limited to 'app/Compiler.hs')
| -rw-r--r-- | app/Compiler.hs | 12 |
1 files changed, 2 insertions, 10 deletions
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 |
