summaryrefslogtreecommitdiff
path: root/app/Builtins.hs
blob: 272eca212805745889f6ca94baefe3d2f2ad2d54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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)]
      }