diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-26 13:35:19 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-26 13:35:19 +0100 |
| commit | a26f0f29c02bfb4ec56781397d60abeb498b8c12 (patch) | |
| tree | 9c351e8d2283a8b2564ea770ca0d42d2c4d30701 /app/Compiler.hs | |
| parent | 58367975aed706172487727330670d62fcb0e6d1 (diff) | |
| download | prlg-a26f0f29c02bfb4ec56781397d60abeb498b8c12.tar.gz prlg-a26f0f29c02bfb4ec56781397d60abeb498b8c12.tar.bz2 | |
massive cleanup
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 |
