| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Language.Janus.Interp
- data EvalState
- data EvalError
- type InterpM = StateT EvalState (ExceptT EvalError IO)
- runInterpM :: InterpM a -> IO (Either EvalError a)
- run :: Evaluable a => a -> IO (Either EvalError Val)
- deref :: Ref -> InterpM Val
- refset :: Ref -> Val -> InterpM ()
- pushScope :: InterpM ()
- popFrame :: InterpM ()
- memIsFree :: Ptr -> InterpM Bool
- memGetVal :: Ptr -> InterpM Val
- memGetRc :: Ptr -> InterpM Word
- malloc :: Val -> InterpM Ptr
- memset :: Ptr -> Val -> InterpM ()
- rcIncr :: Ptr -> InterpM ()
- rcDecr :: Ptr -> InterpM ()
- lookupVar :: String -> InterpM Ptr
- putVar :: String -> Ptr -> InterpM ()
- evalVal :: String -> InterpM Val
- allVars :: InterpM [String]
- class Evaluable a where
- class RefEvaluable a where
- class Callable a where
- valGetIdx :: Val -> Val -> InterpM Val
- valSetIdx :: Val -> Val -> Val -> InterpM Val
Documentation
Interpreter error.
Constructors
| OpCallTypeError String [[TypeRep]] [TypeRep] | Operator invocation type error |
| ItemCallError Item EvalError |
|
| IndexOutOfBounds | Tried to access out of bounds index |
| InternalError String | Internal interpreter error - a bug |
| InvalidPointer Ptr | Tried to access unallocated memory cell |
| ExpectedBool Val | Expected boolean value (e.g. in condition) |
| ExpectedRef | Expected reference (e.g. in call operator) |
| NotCallable Val | Given value is not callable |
| OutOfMemory | Cannot allocate more memory cells |
| UndefinedSymbol String | Cannot resolve requested symbol |
| CustomError String | In-code exception |
memIsFree :: Ptr -> InterpM Bool Source #
Check whether given pointer points to unallocated memory cell.
malloc :: Val -> InterpM Ptr Source #
Allocate value in interpreter memory. Returns new memory cell's address.
rcDecr :: Ptr -> InterpM () Source #
Decrement reference count of memory cell at given address. If the RC will reach 0, the cell will be deallocated.
putVar :: String -> Ptr -> InterpM () Source #
Create new, or change existing, variable binding. If the variable has been already exising, its old value's reference count will be decremented.
class Evaluable a where Source #
The Evaluable class denotes enitity which can be evaluated to Val.
Minimal complete definition
class RefEvaluable a where Source #
The RefEvaluable class denotes enitity which can be evaluated to Ref
Minimal complete definition
Instances
class Callable a where Source #
The Callable class denotes enitity which can be called, such as functions.
Minimal complete definition