mirror of
https://github.com/github/semantic.git
synced 2024-12-20 05:11:44 +03:00
Take a stab at typechecking.
This commit is contained in:
parent
6a5c3084ad
commit
de4c3e5f8a
@ -48,6 +48,7 @@ letrec name body = do
|
||||
instance (MonadFail m, LocationFor value ~ Precise, MonadHeap value m) => MonadAddressable Precise value m where
|
||||
deref = derefWith (maybeM uninitializedAddress . unLatest)
|
||||
alloc _ = do
|
||||
-- Compute the next available address in the heap, then write an empty value into it.
|
||||
addr <- fmap (Address . Precise . heapSize) getHeap
|
||||
addr <$ modifyHeap (heapInit addr mempty)
|
||||
|
||||
|
@ -261,6 +261,9 @@ instance (Alternative m, MonadEnvironment Type m, MonadFail m, MonadFresh m, Mon
|
||||
rational _ = pure Type.Rational
|
||||
multiple = pure . Type.Product
|
||||
array = pure . Type.Array
|
||||
klass _ _ = pure Object
|
||||
|
||||
objectEnvironment _ = pure mempty
|
||||
|
||||
ifthenelse cond if' else' = unify cond Bool *> (if' <|> else')
|
||||
|
||||
|
@ -20,6 +20,7 @@ data Type
|
||||
| Var TName -- ^ A type variable.
|
||||
| Product [Type] -- ^ N-ary products.
|
||||
| Array [Type] -- ^ Arrays. Note that this is heterogenous.
|
||||
| Object -- ^ Objects. Once we have some notion of inheritance we'll need to store a superclass.
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
-- TODO: À la carte representation of types.
|
||||
|
Loading…
Reference in New Issue
Block a user