diff options
| author | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-12 17:47:51 +0100 |
|---|---|---|
| committer | Mirek Kratochvil <exa.exa@gmail.com> | 2022-11-12 17:47:51 +0100 |
| commit | b9633a33182f5b381e912366273709e59f469bb9 (patch) | |
| tree | 0b7eb7f1e67792253cfaf9caee3a92570ab60407 /app/Builtins.hs | |
| parent | fe6666d204c0728b4556574ddc184bc46013b193 (diff) | |
| download | prlg-b9633a33182f5b381e912366273709e59f469bb9.tar.gz prlg-b9633a33182f5b381e912366273709e59f469bb9.tar.bz2 | |
reorg.
Diffstat (limited to 'app/Builtins.hs')
| -rw-r--r-- | app/Builtins.hs | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/app/Builtins.hs b/app/Builtins.hs new file mode 100644 index 0000000..272eca2 --- /dev/null +++ b/app/Builtins.hs @@ -0,0 +1,31 @@ +module Builtins where + +import Code hiding (defs) +import Control.Monad.Trans.State.Lazy +import qualified Data.Map as M +import Env +import qualified Operators as O + +addBuiltins :: PrlgEnv () +addBuiltins = do + a1 <- findStruct "a" 1 + a <- findAtom "a" + b <- findAtom "b" + c <- findAtom "c" + b0 <- findStruct "b" 0 + any <- findStruct "any" 1 + eq <- findStruct "=" 2 + modify $ \s -> + s + { defs = + M.fromList + [ (eq, [[U (LocalRef 0), U (LocalRef 0), NoGoal]]) + , (a1, [[U (Atom a), NoGoal], [U (Atom b), NoGoal]]) + , ( b0 + , [ [Goal, U (Struct a1), U (Atom c), LastCall] + , [Goal, U (Struct a1), U (Atom b), LastCall] + ]) + , (any, [[U VoidRef, NoGoal]]) + ] + , ops = [(O.xfy "," 1000), (O.xfx "=" 700)] + } |
