sutori-0.2.4: Sutori language compiler

Safe HaskellSafe
LanguageHaskell2010

Sutori.Parser.Definitions

Description

 

Synopsis

Documentation

whenSymbolIsNew :: SutSymbol a => (SutID -> SymTable -> [a]) -> SutID -> SutMonad () -> SutMonad () Source #

Decides on whether the given SutID was used for a different symbol in the same scope

defVariable :: SutID -> SutTypeID -> (SutID, Maybe SutExpression) -> SutMonad (Maybe SutInstruction) Source #

Defines a new variable of given type and optionally assigns it an initial value.

insertType :: SutID -> SutID -> SutMonad SutID Source #

Defines a SutID to be now known as a type

defineType :: SutID -> SutTypeID -> SutMonad () Source #

Associates the SutID to the newly constructed type

defPerson :: SutID -> SutMonad () Source #

Includes a new person into the story

defParams :: [SutParam] -> SutMonad [SutInstruction] Source #

Defines a new parameter into a function's scope.

defVariables :: SutID -> SutTypeID -> [(SutID, Maybe SutExpression)] -> SutMonad [SutInstruction] Source #

Defined a list of variables and returns a list of instructions, if any definition included an assigment

defModule :: SutID -> SutAST -> SutMonad () Source #

Defines a module for importing/exporting

Right now it's basically a stub as there's only one module and the data structure only keeps the SutID and AST

defineFunction :: SutID -> SutAST -> SutMonad () Source #

Defines a AST-able function (updates the top function with this ID's AST)

Note: We are now in the scope the function is being defined

insertFunction :: SutID -> SutTypeID -> [SutParam] -> SutMonad SutID Source #

Inserts a new function symbol with a given name, type and parameters, if none is present (no body yet)

Is this action's job to build the initial function symbol (and that includes the PreAST)

Note: We are inside the function's scope, so we need to insert the symbol in the second-to-last scope